mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
controllers with rspec3 syntax
This commit is contained in:
parent
c96220ca76
commit
bc73238c8f
50 changed files with 955 additions and 955 deletions
|
@ -3,20 +3,20 @@ require 'spec_helper'
|
|||
describe DraftController do
|
||||
|
||||
it 'requires you to be logged in' do
|
||||
lambda { post :update }.should raise_error(Discourse::NotLoggedIn)
|
||||
expect { post :update }.to raise_error(Discourse::NotLoggedIn)
|
||||
end
|
||||
|
||||
it 'saves a draft on update' do
|
||||
user = log_in
|
||||
post :update, draft_key: 'xyz', data: 'my data', sequence: 0
|
||||
Draft.get(user, 'xyz', 0).should == 'my data'
|
||||
expect(Draft.get(user, 'xyz', 0)).to eq('my data')
|
||||
end
|
||||
|
||||
it 'destroys drafts when required' do
|
||||
user = log_in
|
||||
Draft.set(user, 'xxx', 0, 'hi')
|
||||
delete :destroy, draft_key: 'xxx', sequence: 0
|
||||
Draft.get(user, 'xxx', 0).should == nil
|
||||
expect(Draft.get(user, 'xxx', 0)).to eq(nil)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue