Skip to content

Instantly share code, notes, and snippets.

@VelizarHristov
Created October 9, 2015 22:34
Show Gist options
  • Save VelizarHristov/db1a2e42b837ee1339e5 to your computer and use it in GitHub Desktop.
Save VelizarHristov/db1a2e42b837ee1339e5 to your computer and use it in GitHub Desktop.
def setup
FactoryGirl.create :customer, nickname: 'foo'
FactoryGirl.create :customer, nickname: 'bar'
FactoryGirl.create :customer, nickname: 'baz'
FactoryGirl.create :customer, nickname: 'foofoo'
FactoryGirl.create :customer, nickname: 'barBaz'
end
context "exists_by_nickname" do
should "be true sometimes" do
assert Customer.exists_by_nickname('foo')
assert Customer.exists_by_nickname('foofoo')
assert Customer.exists_by_nickname('baz')
end
should "be false sometimes" do
assert_not Customer.exists_by_nickname('foe')
assert_not Customer.exists_by_nickname('foof')
assert_not Customer.exists_by_nickname('fool')
end
should "be case insensitive" do
assert Customer.exists_by_nickname('barbaz')
assert Customer.exists_by_nickname('bARBaz')
assert Customer.exists_by_nickname('BaZ')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment