Sha256: 9e4a98816b1ddf60889487059aab9eab4f914a55811752c6b88a103a6f313516

Contents?: true

Size: 737 Bytes

Versions: 38

Compression:

Stored size: 737 Bytes

Contents

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

class HaveReadonlyAttributesMatcherTest < ActiveSupport::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

38 entries across 38 versions & 10 rubygems

Version Path
auser-poolparty-1.3.0 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.1 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.10 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.11 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.12 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.13 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.14 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.15 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.16 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.17 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.2 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.3 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.4 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.5 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.6 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.7 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
auser-poolparty-1.3.8 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
fairchild-poolparty-1.3.17 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
fairchild-poolparty-1.3.5 vendor/gems/shoulda/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
iGEL-shoulda-2.10.2 test/matchers/active_record/have_readonly_attributes_matcher_test.rb