Sha256: ecfdf94f9b60796bc637b598b617a5db6c5fe444e54938dd8e67c536c6c4c302

Contents?: true

Size: 690 Bytes

Versions: 91

Compression:

Stored size: 690 Bytes

Contents

require '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

91 entries across 61 versions & 10 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
challah-0.6.2 vendor/bundle/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
challah-0.6.1 vendor/bundle/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb
challah-0.6.0 vendor/bundle/gems/shoulda-2.11.3/test/matchers/active_record/have_readonly_attributes_matcher_test.rb