prepare for RSpec 3.0

This commit is contained in:
wvengen 2014-08-19 11:39:33 +02:00
parent 61a1efdfcf
commit 21838e9c84
7 changed files with 41 additions and 40 deletions

View file

@ -30,9 +30,9 @@ describe Article do
end
it 'knows when it is deleted' do
expect(supplier.deleted?).to be_false
expect(supplier.deleted?).to be false
supplier.mark_as_deleted
expect(supplier.deleted?).to be_true
expect(supplier.deleted?).to be true
end
it 'keeps a price history' do
@ -70,7 +70,7 @@ describe Article do
it 'can find updates' do
changed = article.shared_article_changed?
expect(changed).to_not be_false
expect(changed).to_not be_falsey
expect(changed.length).to be > 1
end
@ -81,12 +81,12 @@ describe Article do
article.update_attributes updated_article.attributes.reject{|k,v| k=='id' or k=='type'}
expect(article.name).to eq(shared_article.name)
# now synchronising shouldn't change anything anymore
expect(article.shared_article_changed?).to be_false
expect(article.shared_article_changed?).to be_falsey
end
it 'does not need to synchronise an imported article' do
article = SharedArticle.find(shared_article.id).build_new_article(supplier)
expect(article.shared_article_changed?).to be_false
expect(article.shared_article_changed?).to be_falsey
end
it 'adapts to foodcoop units when synchronising' do

View file

@ -38,7 +38,7 @@ describe GroupOrderArticle do
it 'can unorder a product' do
goa.update_quantities(rand(1..99), rand(0..99))
goa.update_quantities(0, 0)
expect(GroupOrderArticle.exists?(goa.id)).to be_false
expect(GroupOrderArticle.exists?(goa.id)).to be false
end
end

View file

@ -16,18 +16,18 @@ describe User do
describe 'does not have the role' do
let(:user) { create :user }
it 'admin' do expect(user.role_admin?).to be_false end
it 'finance' do expect(user.role_finance?).to be_false end
it 'article_meta' do expect(user.role_article_meta?).to be_false end
it 'suppliers' do expect(user.role_suppliers?).to be_false end
it 'orders' do expect(user.role_orders?).to be_false end
it 'admin' do expect(user.role_admin?).to be_falsey end
it 'finance' do expect(user.role_finance?).to be_falsey end
it 'article_meta' do expect(user.role_article_meta?).to be_falsey end
it 'suppliers' do expect(user.role_suppliers?).to be_falsey end
it 'orders' do expect(user.role_orders?).to be_falsey end
end
describe do
let(:user) { create :user, password: 'blahblah' }
it 'can authenticate with correct password' do
expect(User.authenticate(user.nick, 'blahblah')).to be_true
expect(User.authenticate(user.nick, 'blahblah')).to be_truthy
end
it 'can not authenticate with incorrect password' do
expect(User.authenticate(user.nick, 'foobar')).to be_nil
@ -51,19 +51,19 @@ describe User do
end
it 'can authenticate using email address' do
expect(User.authenticate(user.email, 'blahblah')).to be_true
expect(User.authenticate(user.email, 'blahblah')).to be_truthy
end
it 'can authenticate when there is no nick' do
user.nick = nil
expect(user).to be_valid
expect(User.authenticate(user.email, 'blahblah')).to be_true
expect(User.authenticate(user.email, 'blahblah')).to be_truthy
end
end
describe 'admin' do
let(:user) { create :admin }
it 'default admin role' do expect(user.role_admin?).to be_true end
it 'default admin role' do expect(user.role_admin?).to be_truthy end
end
end