mongo_mapper 0.14.0.rc1 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +5 -13
  2. data/LICENSE +1 -1
  3. data/{README.rdoc → README.md} +26 -21
  4. data/examples/keys.rb +1 -1
  5. data/examples/modifiers/set.rb +1 -1
  6. data/examples/querying.rb +1 -1
  7. data/examples/safe.rb +2 -2
  8. data/examples/scopes.rb +1 -1
  9. data/lib/mongo_mapper.rb +3 -0
  10. data/lib/mongo_mapper/connection.rb +16 -38
  11. data/lib/mongo_mapper/extensions/object_id.rb +5 -1
  12. data/lib/mongo_mapper/plugins/accessible.rb +1 -1
  13. data/lib/mongo_mapper/plugins/associations/base.rb +10 -2
  14. data/lib/mongo_mapper/plugins/associations/belongs_to_association.rb +1 -1
  15. data/lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb +6 -0
  16. data/lib/mongo_mapper/plugins/associations/in_array_proxy.rb +36 -6
  17. data/lib/mongo_mapper/plugins/associations/in_foreign_array_proxy.rb +136 -0
  18. data/lib/mongo_mapper/plugins/associations/many_association.rb +4 -2
  19. data/lib/mongo_mapper/plugins/associations/one_embedded_proxy.rb +3 -1
  20. data/lib/mongo_mapper/plugins/associations/proxy.rb +11 -3
  21. data/lib/mongo_mapper/plugins/associations/single_association.rb +5 -4
  22. data/lib/mongo_mapper/plugins/dirty.rb +29 -37
  23. data/lib/mongo_mapper/plugins/document.rb +1 -1
  24. data/lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb +1 -1
  25. data/lib/mongo_mapper/plugins/embedded_callbacks.rb +1 -0
  26. data/lib/mongo_mapper/plugins/embedded_document.rb +2 -2
  27. data/lib/mongo_mapper/plugins/identity_map.rb +3 -1
  28. data/lib/mongo_mapper/plugins/indexes.rb +13 -6
  29. data/lib/mongo_mapper/plugins/keys.rb +12 -7
  30. data/lib/mongo_mapper/plugins/keys/key.rb +13 -8
  31. data/lib/mongo_mapper/plugins/modifiers.rb +39 -14
  32. data/lib/mongo_mapper/plugins/persistence.rb +6 -2
  33. data/lib/mongo_mapper/plugins/querying.rb +9 -3
  34. data/lib/mongo_mapper/plugins/querying/decorated_plucky_query.rb +6 -6
  35. data/lib/mongo_mapper/plugins/safe.rb +10 -4
  36. data/lib/mongo_mapper/plugins/scopes.rb +19 -3
  37. data/lib/mongo_mapper/plugins/stats.rb +1 -3
  38. data/lib/mongo_mapper/plugins/strong_parameters.rb +26 -0
  39. data/lib/mongo_mapper/railtie.rb +1 -0
  40. data/lib/mongo_mapper/utils.rb +2 -2
  41. data/lib/mongo_mapper/version.rb +1 -1
  42. data/spec/examples.txt +1729 -0
  43. data/spec/functional/accessible_spec.rb +7 -1
  44. data/spec/functional/associations/belongs_to_polymorphic_proxy_spec.rb +2 -2
  45. data/spec/functional/associations/belongs_to_proxy_spec.rb +55 -5
  46. data/spec/functional/associations/in_array_proxy_spec.rb +149 -14
  47. data/spec/functional/associations/in_foreign_array_proxy_spec.rb +321 -0
  48. data/spec/functional/associations/many_documents_as_proxy_spec.rb +6 -6
  49. data/spec/functional/associations/many_documents_proxy_spec.rb +22 -22
  50. data/spec/functional/associations/many_embedded_polymorphic_proxy_spec.rb +2 -2
  51. data/spec/functional/associations/many_polymorphic_proxy_spec.rb +4 -4
  52. data/spec/functional/associations/one_as_proxy_spec.rb +8 -8
  53. data/spec/functional/associations/one_embedded_proxy_spec.rb +28 -0
  54. data/spec/functional/associations/one_proxy_spec.rb +19 -9
  55. data/spec/functional/associations_spec.rb +3 -3
  56. data/spec/functional/binary_spec.rb +2 -2
  57. data/spec/functional/caching_spec.rb +15 -22
  58. data/spec/functional/callbacks_spec.rb +2 -2
  59. data/spec/functional/counter_cache_spec.rb +10 -10
  60. data/spec/functional/dirty_spec.rb +48 -10
  61. data/spec/functional/dirty_with_callbacks_spec.rb +59 -0
  62. data/spec/functional/document_spec.rb +5 -8
  63. data/spec/functional/dumpable_spec.rb +1 -1
  64. data/spec/functional/embedded_document_spec.rb +5 -5
  65. data/spec/functional/identity_map_spec.rb +8 -8
  66. data/spec/functional/indexes_spec.rb +19 -18
  67. data/spec/functional/keys_spec.rb +51 -33
  68. data/spec/functional/logger_spec.rb +2 -2
  69. data/spec/functional/modifiers_spec.rb +81 -19
  70. data/spec/functional/partial_updates_spec.rb +8 -8
  71. data/spec/functional/protected_spec.rb +1 -1
  72. data/spec/functional/querying_spec.rb +70 -22
  73. data/spec/functional/safe_spec.rb +23 -27
  74. data/spec/functional/sci_spec.rb +7 -7
  75. data/spec/functional/scopes_spec.rb +89 -1
  76. data/spec/functional/static_keys_spec.rb +2 -2
  77. data/spec/functional/stats_spec.rb +28 -12
  78. data/spec/functional/strong_parameters_spec.rb +49 -0
  79. data/spec/functional/validations_spec.rb +8 -16
  80. data/spec/quality_spec.rb +1 -1
  81. data/spec/spec_helper.rb +39 -8
  82. data/spec/support/matchers.rb +1 -1
  83. data/spec/unit/associations/proxy_spec.rb +13 -5
  84. data/spec/unit/clone_spec.rb +1 -1
  85. data/spec/unit/document_spec.rb +3 -3
  86. data/spec/unit/embedded_document_spec.rb +4 -5
  87. data/spec/unit/extensions_spec.rb +2 -2
  88. data/spec/unit/identity_map_middleware_spec.rb +65 -96
  89. data/spec/unit/key_spec.rb +16 -17
  90. data/spec/unit/keys_spec.rb +17 -8
  91. data/spec/unit/mongo_mapper_spec.rb +41 -88
  92. data/spec/unit/rails_spec.rb +2 -2
  93. data/spec/unit/validations_spec.rb +18 -18
  94. metadata +53 -31
  95. data/lib/mongo_mapper/extensions/ordered_hash.rb +0 -23
data/spec/quality_spec.rb CHANGED
@@ -46,6 +46,6 @@ describe "The library itself" do
46
46
  error_messages << check_for_extra_spaces(filename)
47
47
  end
48
48
  end
49
- expect(error_messages.compact).to be_well_formed
49
+ error_messages.compact.should be_well_formed
50
50
  end
51
51
  end
data/spec/spec_helper.rb CHANGED
@@ -2,10 +2,21 @@ $:.unshift(File.expand_path('../../lib', __FILE__))
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bundler/setup'
5
+
6
+ # workaround for https://github.com/jruby/jruby/issues/6547
7
+ if RUBY_PLATFORM == 'java'
8
+ require 'i18n/backend'
9
+ require 'i18n/backend/simple'
10
+ end
11
+
12
+ Bundler.require(:default)
5
13
  require 'fileutils'
6
14
  require 'timecop'
7
15
  require "generator_spec/test_case"
8
- # require 'ruby-debug'
16
+
17
+ if RUBY_ENGINE == "ruby" && RUBY_VERSION >= '2.3'
18
+ require 'byebug'
19
+ end
9
20
 
10
21
  if RUBY_PLATFORM != "java"
11
22
  if ENV['TRAVIS']
@@ -40,7 +51,7 @@ def Doc(name='Class', &block)
40
51
  end
41
52
 
42
53
  klass.class_eval(&block) if block_given?
43
- klass.collection.remove
54
+ klass.collection.drop
44
55
  klass
45
56
  end
46
57
 
@@ -59,21 +70,28 @@ def EDoc(name='Class', &block)
59
70
  end
60
71
 
61
72
  def drop_indexes(klass)
62
- klass.collection.drop_indexes if klass.database.collection_names.include?(klass.collection.name)
73
+ klass.collection.indexes.drop_all if klass.database.collection_names.include?(klass.collection.name)
63
74
  end
64
75
 
65
76
  log_dir = File.expand_path('../../log', __FILE__)
66
77
  FileUtils.mkdir_p(log_dir) unless File.exist?(log_dir)
67
78
  logger = Logger.new(log_dir + '/test.log')
68
79
 
69
- MongoMapper.connection = Mongo::MongoClient.new('127.0.0.1', 27017, :logger => logger)
70
- MongoMapper.database = "test"
71
- MongoMapper.database.collections.each { |c| c.drop_indexes }
80
+ Mongo::Logger.logger = logger
81
+
82
+ MongoMapper.connection = Mongo::Client.new(['127.0.0.1:27017'], :database => 'test')
83
+ MongoMapper.database.collections.each { |c| c.indexes.drop_all }
72
84
  Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
73
85
 
74
86
  RSpec.configure do |config|
87
+ config.example_status_persistence_file_path = "./spec/examples.txt"
88
+
75
89
  config.expect_with :rspec do |c|
76
- c.syntax = [:should, :expect]
90
+ c.syntax = :should
91
+ end
92
+
93
+ config.mock_with :rspec do |mocks|
94
+ mocks.syntax = :should
77
95
  end
78
96
 
79
97
  config.around(:each, :without_connection) do |example|
@@ -81,5 +99,18 @@ RSpec.configure do |config|
81
99
  example.run
82
100
  MongoMapper.connection = old
83
101
  end
84
- end
85
102
 
103
+ def suppress_stderr
104
+ begin
105
+ original_stderr = $stderr.clone
106
+ $stderr.reopen(File.new('/dev/null', 'w'))
107
+ retval = yield
108
+ rescue Exception => e
109
+ $stderr.reopen(original_stderr)
110
+ raise e
111
+ ensure
112
+ $stderr.reopen(original_stderr)
113
+ end
114
+ retval
115
+ end
116
+ end
@@ -10,6 +10,6 @@ end
10
10
 
11
11
  RSpec::Matchers.define :have_index do |index_name|
12
12
  match do |model|
13
- model.collection.index_information.detect { |index| index[0] == index_name }.present?
13
+ model.collection.indexes.get(index_name).present?
14
14
  end
15
15
  end
@@ -77,10 +77,6 @@ describe "Proxy" do
77
77
  @proxy.proxy_owner.should == @owner
78
78
  end
79
79
 
80
- it "should alias proxy target to target" do
81
- @proxy.proxy_target.should == @target
82
- end
83
-
84
80
  context "send" do
85
81
  it "should work if proxy responds to method" do
86
82
  @proxy.send(:reset)
@@ -92,12 +88,24 @@ describe "Proxy" do
92
88
  end
93
89
 
94
90
  it "should not work if neither the proxy or target respond to method" do
95
- lambda { @proxy.send(:gsub) }.should raise_error
91
+ lambda { @proxy.send(:gsub) }.should raise_error(NoMethodError)
96
92
  end
97
93
 
98
94
  it "should work if a proc is passed" do
99
95
  p = Proc.new {|x| x+1}
100
96
  @proxy.send(:collect, &p).should == [2,3]
101
97
  end
98
+
99
+ it "should not respond to private method" do
100
+ @proxy.reload # To load @proxy.target
101
+ @proxy.target.extend(Module.new do
102
+ private
103
+
104
+ def private_foo
105
+ end
106
+ end)
107
+
108
+ lambda { @proxy.private_foo }.should raise_error(NoMethodError, /private method `private_foo' called/)
109
+ end
102
110
  end
103
111
  end
@@ -45,7 +45,7 @@ describe "Clone" do
45
45
  end
46
46
 
47
47
  it "should clone a cloned document" do
48
- expect { @doc.clone.clone }.to_not raise_error
48
+ lambda { @doc.clone.clone }.should_not raise_error
49
49
  @doc.clone.clone.id.should be_a BSON::ObjectId
50
50
  end
51
51
  end
@@ -21,11 +21,11 @@ describe "Document" do
21
21
  end
22
22
 
23
23
  it "should have a connection" do
24
- @document.connection.should be_instance_of(Mongo::MongoClient)
24
+ @document.connection.should be_instance_of(Mongo::Client)
25
25
  end
26
26
 
27
27
  it "should allow setting different connection without affecting the default" do
28
- conn = Mongo::MongoClient.new
28
+ conn = Mongo::Client.new(['127.0.0.1:27001'])
29
29
  @document.connection conn
30
30
  @document.connection.should == conn
31
31
  @document.connection.should_not == MongoMapper.connection
@@ -152,7 +152,7 @@ describe "Document" do
152
152
 
153
153
  it "should be true if id but using custom id and not saved yet" do
154
154
  @document.key :_id, String
155
- doc = silence_stderr { @document.new }
155
+ doc = suppress_stderr { @document.new }
156
156
  doc.id = '1234'
157
157
  doc.new?.should be_truthy
158
158
  end
@@ -210,7 +210,7 @@ describe "EmbeddedDocument" do
210
210
  end
211
211
 
212
212
  it "should not include descendant keys" do
213
- lambda { Parent.new.other_child }.should raise_error
213
+ lambda { Parent.new.other_child }.should raise_error(NoMethodError)
214
214
  end
215
215
  end
216
216
 
@@ -308,7 +308,7 @@ describe "EmbeddedDocument" do
308
308
  end
309
309
 
310
310
  it "should not throw error if initialized with nil" do
311
- expect { @document.new(nil) }.to_not raise_error
311
+ lambda { @document.new(nil) }.should_not raise_error
312
312
  end
313
313
  end
314
314
 
@@ -661,16 +661,15 @@ describe "EmbeddedDocument" do
661
661
 
662
662
  it "should should raise errors when invalid" do
663
663
  @doc.name = ''
664
- expect { @doc.save! }.to raise_error(MongoMapper::DocumentNotValid)
664
+ lambda { @doc.save! }.should raise_error(MongoMapper::DocumentNotValid)
665
665
  end
666
666
 
667
667
  it "should should raise errors when root document is invalid" do
668
668
  @root.name = ''
669
669
  @root.save(:validate => false)
670
- expect{ @doc.save! }.to raise_error(MongoMapper::DocumentNotValid)
670
+ lambda { @doc.save! }.should raise_error(MongoMapper::DocumentNotValid)
671
671
  end
672
672
  end
673
673
  end # instance of a embedded document
674
674
  end
675
675
  end
676
-
@@ -207,7 +207,7 @@ describe "Support" do
207
207
  context "ObjectId#to_mongo" do
208
208
  it "should call class to_mongo with self" do
209
209
  object = Object.new
210
- expect(object.class).to receive(:to_mongo).with(object)
210
+ object.class.should_receive(:to_mongo).with(object)
211
211
  object.to_mongo
212
212
  end
213
213
  end
@@ -387,7 +387,7 @@ describe "Support" do
387
387
 
388
388
  it "should support ruby driver syntax also" do
389
389
  id = BSON::ObjectId.new
390
- id.original_to_json.should == %Q({"$oid": "#{id}"})
390
+ id.original_to_json.should == %Q({"$oid":"#{id}"})
391
391
  end
392
392
  end
393
393
  end
@@ -19,116 +19,85 @@ module IdentityMapSpec
19
19
  end.to_app
20
20
  end
21
21
 
22
- context "" do
23
- before do
24
- @enabled = MongoMapper::Plugins::IdentityMap.enabled
25
- MongoMapper::Plugins::IdentityMap.enabled = false
26
- end
22
+ before do
23
+ @enabled = MongoMapper::Plugins::IdentityMap.enabled
24
+ MongoMapper::Plugins::IdentityMap.enabled = false
25
+ end
27
26
 
28
- after do
29
- MongoMapper::Plugins::IdentityMap.enabled = @enabled
30
- end
27
+ after do
28
+ MongoMapper::Plugins::IdentityMap.enabled = @enabled
29
+ end
31
30
 
32
- it "should delegate" do
33
- called = false
34
- mw = MongoMapper::Middleware::IdentityMap.new lambda { |env|
35
- called = true
36
- [200, {}, nil]
37
- }
38
- mw.call({})
39
- called.should be_truthy
40
- end
31
+ it "should delegate" do
32
+ called = false
33
+ mw = MongoMapper::Middleware::IdentityMap.new lambda { |env|
34
+ called = true
35
+ [200, {}, nil]
36
+ }
37
+ mw.call({})
38
+ called.should be_truthy
39
+ end
41
40
 
42
- it "should enable identity map during delegation" do
43
- mw = MongoMapper::Middleware::IdentityMap.new lambda { |env|
44
- MongoMapper::Plugins::IdentityMap.should be_enabled
45
- [200, {}, nil]
46
- }
47
- mw.call({})
48
- end
41
+ it "should enable identity map during delegation" do
42
+ mw = MongoMapper::Middleware::IdentityMap.new lambda { |env|
43
+ MongoMapper::Plugins::IdentityMap.should be_enabled
44
+ [200, {}, nil]
45
+ }
46
+ mw.call({})
47
+ end
49
48
 
50
- class Enum < Struct.new(:iter)
51
- def each(&b)
52
- iter.call(&b)
53
- end
49
+ class Enum < Struct.new(:iter)
50
+ def each(&b)
51
+ iter.call(&b)
54
52
  end
53
+ end
55
54
 
56
- it "should enable IM for body each" do
57
- mw = MongoMapper::Middleware::IdentityMap.new lambda { |env|
58
- [200, {}, Enum.new(lambda { |&b|
59
- MongoMapper::Plugins::IdentityMap.should be_enabled
60
- b.call "hello"
61
- })]
62
- }
63
- body = mw.call({}).last
64
- body.each { |x| x.should eql('hello') }
65
- end
55
+ it "should enable IM for body each" do
56
+ mw = MongoMapper::Middleware::IdentityMap.new lambda { |env|
57
+ [200, {}, Enum.new(lambda { |&b|
58
+ MongoMapper::Plugins::IdentityMap.should be_enabled
59
+ b.call "hello"
60
+ })]
61
+ }
62
+ body = mw.call({}).last
63
+ body.each { |x| x.should eql('hello') }
64
+ end
66
65
 
67
- it "should disable IM after body close" do
68
- mw = MongoMapper::Middleware::IdentityMap.new lambda { |env| [200, {}, []] }
69
- body = mw.call({}).last
70
- MongoMapper::Plugins::IdentityMap.should be_enabled
71
- body.close
72
- MongoMapper::Plugins::IdentityMap.should_not be_enabled
73
- end
66
+ it "should disable IM after body close" do
67
+ mw = MongoMapper::Middleware::IdentityMap.new lambda { |env| [200, {}, []] }
68
+ body = mw.call({}).last
69
+ MongoMapper::Plugins::IdentityMap.should be_enabled
70
+ body.close
71
+ MongoMapper::Plugins::IdentityMap.should_not be_enabled
72
+ end
74
73
 
75
- it "should clear IM after body close" do
76
- mw = MongoMapper::Middleware::IdentityMap.new lambda { |env| [200, {}, []] }
77
- body = mw.call({}).last
74
+ it "should clear IM after body close" do
75
+ mw = MongoMapper::Middleware::IdentityMap.new lambda { |env| [200, {}, []] }
76
+ body = mw.call({}).last
78
77
 
79
- MongoMapper::Plugins::IdentityMap.repository['hello'] = 'world'
80
- MongoMapper::Plugins::IdentityMap.repository.should_not be_empty
78
+ MongoMapper::Plugins::IdentityMap.repository['hello'] = 'world'
79
+ MongoMapper::Plugins::IdentityMap.repository.should_not be_empty
81
80
 
82
- body.close
81
+ body.close
83
82
 
84
- MongoMapper::Plugins::IdentityMap.repository.should be_empty
85
- end
83
+ MongoMapper::Plugins::IdentityMap.repository.should be_empty
84
+ end
86
85
 
87
- context "with a successful request" do
88
- it "should clear the identity map" do
89
- expect(MongoMapper::Plugins::IdentityMap).to receive(:clear).twice
90
- get '/'
91
- end
86
+ context "with a successful request" do
87
+ it "should clear the identity map" do
88
+ # for some reason, body.close gets called twice - once in rack-2.2.3/lib/rack/response.rb:281
89
+ # the other time rack-test-0.8.3/lib/rack/mock_session.rb:32
90
+ # use at_least(:twice) here to handle the error happening more than twice
91
+ MongoMapper::Plugins::IdentityMap.should_receive(:clear).at_least(:twice)
92
+ get '/'
92
93
  end
94
+ end
93
95
 
94
- context "when the request raises an error" do
95
- it "should clear the identity map" do
96
- expect(MongoMapper::Plugins::IdentityMap).to receive(:clear).once
97
- get '/fail' rescue nil
98
- end
96
+ context "when the request raises an error" do
97
+ it "should clear the identity map" do
98
+ MongoMapper::Plugins::IdentityMap.should_receive(:clear).once
99
+ get '/fail' rescue nil
99
100
  end
100
101
  end
101
102
  end
102
-
103
- # describe "IdentityMapMiddleware" do
104
- # include Rack::Test::Methods
105
-
106
- # def app
107
- # @app ||= Rack::Builder.new do
108
- # use MongoMapper::Middleware::IdentityMap
109
- # map "/" do
110
- # run lambda {|env| [200, {}, []] }
111
- # end
112
- # map "/fail" do
113
- # run lambda {|env| raise "FAIL!" }
114
- # end
115
- # end.to_app
116
- # end
117
-
118
- # context "with a successful request" do
119
- # it "should clear the identity map" do
120
- # expect(MongoMapper::Plugins::IdentityMap).to receive(:clear).twice
121
- # get '/'
122
- # end
123
- # end
124
-
125
- # context "when the request raises an error" do
126
- # it "should clear the identity map" do
127
- # expect(MongoMapper::Plugins::IdentityMap).to receive(:clear).twice
128
- # get '/fail' rescue nil
129
- # end
130
- # end
131
-
132
-
133
- # end
134
- end
103
+ end
@@ -1,6 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
-
4
3
  class FooType < Struct.new(:bar)
5
4
  def self.to_mongo(value)
6
5
  'to_mongo'
@@ -60,19 +59,19 @@ describe "Key" do
60
59
  end
61
60
 
62
61
  it "should not permit reserved names" do
63
- expect { Key.new(:id) }.to raise_error(/reserved/)
62
+ lambda { Key.new(:id) }.should raise_error(/reserved/)
64
63
  end
65
64
 
66
65
  it "should not permit bad names" do
67
- expect { Key.new(:"id.bar") }.to raise_error(/must match/)
66
+ lambda { Key.new(:"id.bar") }.should raise_error(/must match/)
68
67
  end
69
68
 
70
69
  it "should permit bad names if __dynamic" do
71
- expect { Key.new(:"id.bar", :__dynamic => true) }.to_not raise_error
70
+ lambda { Key.new(:"id.bar", :__dynamic => true) }.should_not raise_error
72
71
  end
73
72
 
74
73
  it "should permit bad names if it is not to create accessors" do
75
- expect { Key.new(:"id.bar", :accessors => :skip) }.to_not raise_error
74
+ lambda { Key.new(:"id.bar", :accessors => :skip) }.should_not raise_error
76
75
  end
77
76
  end
78
77
 
@@ -149,33 +148,33 @@ describe "Key" do
149
148
  context "with :read" do
150
149
  let(:accessor) { :read }
151
150
 
152
- it { expect( subject.read_accessor? ).to be_truthy }
153
- it { expect( subject.write_accessor? ).to be_falsey }
154
- it { expect( subject.predicate_accessor? ).to be_falsey }
151
+ it { subject.read_accessor?.should be_truthy }
152
+ it { subject.write_accessor?.should be_falsey }
153
+ it { subject.predicate_accessor?.should be_falsey }
155
154
  end
156
155
 
157
156
  context "with :write" do
158
157
  let(:accessor) { :write }
159
158
 
160
- it { expect( subject.read_accessor? ).to be_falsey }
161
- it { expect( subject.write_accessor? ).to be_truthy }
162
- it { expect( subject.predicate_accessor? ).to be_falsey }
159
+ it { subject.read_accessor?.should be_falsey }
160
+ it { subject.write_accessor?.should be_truthy }
161
+ it { subject.predicate_accessor?.should be_falsey }
163
162
  end
164
163
 
165
164
  context "with :predicate" do
166
165
  let(:accessor) { :predicate }
167
166
 
168
- it { expect( subject.read_accessor? ).to be_falsey }
169
- it { expect( subject.write_accessor? ).to be_falsey }
170
- it { expect( subject.predicate_accessor? ).to be_truthy }
167
+ it { subject.read_accessor?.should be_falsey }
168
+ it { subject.write_accessor?.should be_falsey }
169
+ it { subject.predicate_accessor?.should be_truthy }
171
170
  end
172
171
 
173
172
  context "with an array of options" do
174
173
  let(:accessor) { [:read, :write] }
175
174
 
176
- it { expect( subject.read_accessor? ).to be_truthy }
177
- it { expect( subject.write_accessor? ).to be_truthy }
178
- it { expect( subject.predicate_accessor? ).to be_falsey }
175
+ it { subject.read_accessor?.should be_truthy }
176
+ it { subject.write_accessor?.should be_truthy }
177
+ it { subject.predicate_accessor?.should be_falsey }
179
178
  end
180
179
  end
181
180