Skip to content

Instantly share code, notes, and snippets.

@natikgadzhi
Created July 22, 2013 18:42
Show Gist options
  • Save natikgadzhi/6056408 to your computer and use it in GitHub Desktop.
Save natikgadzhi/6056408 to your computer and use it in GitHub Desktop.
describe "validation" do
%w(http://test.com https://test.com itns://something).each do |uri|
it "should allow valid uri: #{uri}" do
banner = FactoryGirl.build(:banner, url: uri, enabled: true)
expect(banner).to be_valid
end
end
["shit happens", "alsow12414@@!!!wrong", "", nil].each do |uri|
it "should disallow valid uri: #{uri}" do
banner = FactoryGirl.build(:banner, url: uri, enabled: true)
expect(banner).not_to be_valid
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment