Sha256: eda8149e5813dd577af4111f63f246f8de28db3df4302b55bc0e6c954f093b7a

Contents?: true

Size: 734 Bytes

Versions: 10

Compression:

Stored size: 734 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'test_helper')

class HaveReadonlyAttributesMatcherTest < Test::Unit::TestCase # :nodoc:

  context "an attribute that cannot be set after being saved" do
    setup do
      define_model :example, :attr => :string do
        attr_readonly :attr
      end
      @model = Example.new
    end

    should "accept being read-only" do
      assert_accepts have_readonly_attribute(:attr), @model
    end
  end

  context "an attribute that can be set after being saved" do
    setup do
      define_model :example, :attr => :string
      @model = Example.new
    end

    should "accept being read-only" do
      assert_rejects have_readonly_attribute(:attr), @model
    end
  end

end

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
Flamefork-shoulda-2.10.2 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
francois-shoulda-2.10.1 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
technicalpickles-shoulda-2.10.0 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
thoughtbot-shoulda-2.10.0 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
thoughtbot-shoulda-2.10.1 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
thoughtbot-shoulda-2.9.2 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
shoulda-2.9.2 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
shoulda-2.10.0 test/matchers/active_record/have_readonly_attributes_matcher_test.rb
shoulda-2.10.1 test/matchers/active_record/have_readonly_attributes_matcher_test.rb