mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:08:10 +08:00
fix most deprecations in the specs (still some left)
This commit is contained in:
@ -11,7 +11,7 @@ describe Draft do
|
||||
|
||||
it "uses the user id and key correctly" do
|
||||
Draft.set(@user, "test", 0,"data")
|
||||
Draft.get(Fabricate.build(:coding_horror), "test", 0).should be_nil
|
||||
Draft.get(Fabricate.build(:coding_horror), "test", 0).should == nil
|
||||
end
|
||||
|
||||
it "should overwrite draft data correctly" do
|
||||
@ -23,14 +23,14 @@ describe Draft do
|
||||
it "should clear drafts on request" do
|
||||
Draft.set(@user, "test", 0, "data")
|
||||
Draft.clear(@user, "test", 0)
|
||||
Draft.get(@user, "test", 0).should be_nil
|
||||
Draft.get(@user, "test", 0).should == nil
|
||||
end
|
||||
|
||||
it "should disregard old draft if sequence decreases" do
|
||||
Draft.set(@user, "test", 0, "data")
|
||||
Draft.set(@user, "test", 1, "hello")
|
||||
Draft.set(@user, "test", 0, "foo")
|
||||
Draft.get(@user, "test", 0).should be_nil
|
||||
Draft.get(@user, "test", 0).should == nil
|
||||
Draft.get(@user, "test", 1).should == "hello"
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ describe Draft do
|
||||
Draft.set(u, Draft::NEW_TOPIC, 0, 'my draft')
|
||||
_t = Fabricate(:topic, user: u)
|
||||
s = DraftSequence.current(u, Draft::NEW_TOPIC)
|
||||
Draft.get(u, Draft::NEW_TOPIC, s).should be_nil
|
||||
Draft.get(u, Draft::NEW_TOPIC, s).should == nil
|
||||
end
|
||||
|
||||
it 'nukes new pm draft after a pm is created' do
|
||||
@ -49,7 +49,7 @@ describe Draft do
|
||||
Draft.set(u, Draft::NEW_PRIVATE_MESSAGE, 0, 'my draft')
|
||||
t = Fabricate(:topic, user: u, archetype: Archetype.private_message, category_id: nil)
|
||||
s = DraftSequence.current(t.user, Draft::NEW_PRIVATE_MESSAGE)
|
||||
Draft.get(u, Draft::NEW_PRIVATE_MESSAGE, s).should be_nil
|
||||
Draft.get(u, Draft::NEW_PRIVATE_MESSAGE, s).should == nil
|
||||
end
|
||||
|
||||
it 'does not nuke new topic draft after a pm is created' do
|
||||
@ -67,7 +67,7 @@ describe Draft do
|
||||
Draft.set(p.user, p.topic.draft_key, 0,'hello')
|
||||
|
||||
PostCreator.new(user, raw: Fabricate.build(:post).raw).create
|
||||
Draft.get(p.user, p.topic.draft_key, DraftSequence.current(p.user, p.topic.draft_key)).should be_nil
|
||||
Draft.get(p.user, p.topic.draft_key, DraftSequence.current(p.user, p.topic.draft_key)).should == nil
|
||||
end
|
||||
|
||||
it 'nukes the post draft when a post is revised' do
|
||||
@ -75,7 +75,7 @@ describe Draft do
|
||||
Draft.set(p.user, p.topic.draft_key, 0,'hello')
|
||||
p.revise(p.user, 'another test')
|
||||
s = DraftSequence.current(p.user, p.topic.draft_key)
|
||||
Draft.get(p.user, p.topic.draft_key, s).should be_nil
|
||||
Draft.get(p.user, p.topic.draft_key, s).should == nil
|
||||
end
|
||||
|
||||
it 'increases the sequence number when a post is revised' do
|
||||
|
Reference in New Issue
Block a user