Skip to content

Commit

Permalink
Fixed Model.allowed_writer_methods spec
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Jul 24, 2011
1 parent 5c5690d commit 42f22e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dm-core/model.rb
Expand Up @@ -3,7 +3,7 @@ module Model
include Enumerable

WRITER_METHOD_REGEXP = /=\z/.freeze
INVALID_WRITER_METHODS = %w[ == != === []= taguri= attributes= collection= persisted_state= raise_on_save_failure= ].to_set.freeze
INVALID_WRITER_METHODS = %w[ == != === []= taguri= attributes= collection= persistence_state= raise_on_save_failure= ].to_set.freeze

# Creates a new Model class with its constant already set
#
Expand Down
7 changes: 6 additions & 1 deletion spec/public/model_spec.rb
Expand Up @@ -437,6 +437,11 @@ def model?; true end
describe '#allowed_writer_methods' do
subject { @article_model.allowed_writer_methods }

let(:expected_writer_methods) do
%w[ original= revisions= previous= publications= article_publications=
id= title= content= subtitle= original_id= persisted_state= ].to_set
end

it { should be_kind_of(Set) }

it { should be_all { |method| method.kind_of?(String) } }
Expand All @@ -447,7 +452,7 @@ def model?; true end
should equal(instance_eval(&self.class.subject))
end

it { should eql(%w[ original_id= id= publications= original= title= article_publications= revisions= subtitle= content= previous= ].to_set) }
it { should eql(expected_writer_methods) }
end
end
end

0 comments on commit 42f22e6

Please sign in to comment.