Sha256: 7afb58acb535b8dba2446e5e7bedf47193cd12a65a5b504476af26573ac8fe92
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' require File.dirname(__FILE__) + '/../lib/url_field' class TestModel < ActiveRecord::Base url_field :shortcode_url def self.table_name 'boojas' end end describe TestModel do before do @test_model = TestModel.new end it "should leave well enough alone" do @test_model.save @test_model.shortcode_url.should be_nil end it "should REALLY leave well enough alone" do @test_model.shortcode_url = "" @test_model.save @test_model.shortcode_url.should be_nil end it "should add http://" do @test_model.shortcode_url = "www.example.com" @test_model.save @test_model.shortcode_url.should == "http://www.example.com" end it "should ignore http://" do @test_model.shortcode_url = "http://www.example.com" @test_model.save @test_model.shortcode_url.should == "http://www.example.com" end it "should allow https://" do @test_model.shortcode_url = "https://www.example.com" @test_model.save @test_model.shortcode_url.should == "https://www.example.com" end it "should ignore https://" do @test_model.shortcode_url = "https://www.example.com" @test_model.save @test_model.shortcode_url.should == "https://www.example.com" end it "should expose the cleaned method" do @test_model.shortcode_url = "www.example.com" @test_model.cleaned_shortcode_url.should == "http://www.example.com" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
url_field-0.0.1 | spec/url_field_spec.rb |