activerecord-tableless 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 95f9af991df787914a130934cbeec6166323d040
4
- data.tar.gz: 952995596bbf42b852ffd7cba372bec6cc3732a0
3
+ metadata.gz: a6cd620d4d83def99ada323d0e294794eaf03a1a
4
+ data.tar.gz: d5599e3784ac55826458e5c1ed5f38b7b366305a
5
5
  SHA512:
6
- metadata.gz: 9809a4c671fe0d7cb0ff53605a181f797ae4c9ad7c268dc4d738df9531d6a28ef2893bc624bafc5040ee08ec6cfc934b46ef9cb12dd04006cc64bc5287ed130e
7
- data.tar.gz: 71e3c7263f7a52ac49c3d78038663e8d51173149c01d8f76c7b24ad4ffc7907dff4bcad7b06bc647d2de427eae362ac7763900324da613d9c6de2328ebda345c
6
+ metadata.gz: be68c202fd408e586481f2f0c8d0b37cbd67e62b4fcef4d4d562ab00cec5210c20a737b064bf4b65d05c26d6dd7e72a47c1abe85170006346825ae648bc70def
7
+ data.tar.gz: 15d301fa0a246e666c09d485d89fd91ebf5e6a17ef05024fa25b12450267f7d34698df30c9af355bdf8a31d9441691920eeab79b4c9e682a789259d03d3df027
@@ -5,16 +5,22 @@ rvm:
5
5
  - 1.8.7
6
6
  - 1.9.3
7
7
  - 2.0.0
8
+ - 2.1.0
9
+ - 2.1.1
8
10
  gemfile:
9
11
  - gemfiles/rails23.gemfile
10
12
  - gemfiles/rails30.gemfile
11
13
  - gemfiles/rails32.gemfile
12
14
  - gemfiles/rails3x.gemfile
13
15
  - gemfiles/rails40.gemfile
16
+ - gemfiles/rails41.gemfile
14
17
  matrix:
15
18
  exclude:
16
19
  - rvm: 1.8.7
17
20
  gemfile: gemfiles/rails40.gemfile
18
21
  - rvm: 2.0.0
19
22
  gemfile: gemfiles/rails23.gemfile
20
-
23
+ - rvm: 2.1.0
24
+ gemfile: gemfiles/rails23.gemfile
25
+ - rvm: 2.1.1
26
+ gemfile: gemfiles/rails23.gemfile
data/Appraisals CHANGED
@@ -33,3 +33,8 @@ appraise "rails40" do
33
33
  gem "activerecord-tableless", :path => "../"
34
34
  end
35
35
 
36
+ appraise "rails41" do
37
+ gem "rails", "~> 4.1.0"
38
+ gem "jquery-rails"
39
+ gem "activerecord-tableless", :path => "../"
40
+ end
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in utf8_enforcer_workaround.gemspec
4
4
  gemspec
5
+
6
+ gem "mime-types", "< 2.0", :platform => :ruby_18
7
+ gem "rubyzip", "< 1.0", :platform => :ruby_18
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ActiveRecord Tableless
2
2
  ======================
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/softace/activerecord-tableless.png)](http://travis-ci.org/softace/activerecord-tableless)
4
+ [![Build Status](https://travis-ci.org/softace/activerecord-tableless.png)](http://travis-ci.org/softace/activerecord-tableless)
5
5
  [![Dependency Status](https://gemnasium.com/softace/activerecord-tableless.png)](https://gemnasium.com/softace/activerecord-tableless)
6
6
  [![Code Climate](https://codeclimate.com/github/softace/activerecord-tableless.png)](https://codeclimate.com/github/softace/activerecord-tableless)
7
7
 
@@ -13,7 +13,8 @@ Why, why, why
13
13
 
14
14
  Why would you ever consider this gem as opposed to ActiveModel.
15
15
 
16
- In Rails 2 ActiveModel does not exists (this is when it all started; see Hitosry section)
16
+ In Rails 2 ActiveModel does not exists (this is when it all started;
17
+ see Hitosry section)
17
18
 
18
19
  In Rails 3 there is an Active Model API, where you can use some
19
20
  features of Active Record in other classes. Yehuda Katz has written
@@ -46,7 +47,7 @@ Supported Versions
46
47
  Supported version are ActiveRecord version **2.3.x**, **3.0.x**
47
48
  series, **3.2.x** series and **4.x** series
48
49
 
49
- You may be able to make it work with 3.1.X, but you should expect to
50
+ You may be able to make it work with 3.1.x, but you should expect to
50
51
  put some time in it.
51
52
 
52
53
  Usage
@@ -126,4 +127,3 @@ Copyright
126
127
 
127
128
  Copyright (c) Jarl Friis. See LICENSE.txt for
128
129
  further details.
129
-
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'activerecord-tableless'
5
- gem.version = "1.3.3"
5
+ gem.version = "1.3.4"
6
6
  gem.platform = Gem::Platform::RUBY
7
7
  gem.authors = ["Jarl Friis", "Kenneth Kalmer", "Michal Zima"]
8
8
  gem.email = ["jarl@softace.dk"]
@@ -18,19 +18,18 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency("activerecord", ">= 2.3.0")
21
+ gem.add_runtime_dependency("activerecord", ">= 2.3.0")
22
22
 
23
- gem.add_development_dependency('bundler')
24
- gem.add_development_dependency('rake')
23
+ gem.add_development_dependency('bundler', '> 0')
24
+ gem.add_development_dependency('rake', '> 0')
25
25
 
26
26
  # gem.add_development_dependency("rails") # This is in the appraisal gemfiles
27
27
  gem.add_development_dependency('sqlite3', '~> 1.3')
28
28
 
29
- gem.add_development_dependency('appraisal', '~> 0.4')
29
+ gem.add_development_dependency('appraisal', '~> 0.5')
30
30
  gem.add_development_dependency('cucumber', '~> 1.1')
31
- gem.add_development_dependency("rspec")
31
+ gem.add_development_dependency("rspec", '> 0')
32
32
  gem.add_development_dependency('aruba', '>= 0.5')
33
- gem.add_development_dependency('capybara')
34
33
 
35
34
  ##Specifying upper limit version for ruby 1.8.7
36
35
  gem.add_development_dependency('nokogiri', '< 1.6')
@@ -31,22 +31,6 @@ Given /^I run a "(.*?)" generator to generate a "(.*?)" scaffold with "(.*?)"$/
31
31
  step %[I successfully run `bundle exec #{generator_command} #{generator_name} #{model_name} #{attributes}`]
32
32
  end
33
33
 
34
- Given /^I add this snippet to the User model:$/ do |snippet|
35
- file_name = "app/models/user.rb"
36
- in_current_dir do
37
- content = File.read(file_name)
38
- File.open(file_name, 'w') { |f| f << content.sub(/end\Z/, "#{snippet}\nend") }
39
- end
40
- end
41
-
42
- Given /^I add this snippet to the "(.*?)" controller:$/ do |controller_name, snippet|
43
- file_name = "app/controllers/#{controller_name}_controller.rb"
44
- in_current_dir do
45
- content = File.read(file_name)
46
- File.open(file_name, 'w') { |f| f << content.sub(/end\Z/, "#{snippet}\nend") }
47
- end
48
- end
49
-
50
34
  Given /^I start the rails application$/ do
51
35
  in_current_dir do
52
36
  require "./config/environment"
@@ -102,86 +102,25 @@ When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
102
102
  attach_file(field, File.expand_path(path))
103
103
  end
104
104
 
105
- Then /^(?:|I )should see "([^"]*)"$/ do |text|
106
- if page.respond_to? :should
107
- page.should have_content(text)
105
+ Then /^(?:|I )should (not )?see "([^"]*)"$/ do |negate, text|
106
+ should_name = negate ? :should_not : :should
107
+ if page.respond_to? should_name
108
+ page.send should_name, have_content(text)
108
109
  else
109
- assert page.has_content?(text)
110
+ assert(negate ? page.has_no_content?(text) : page.has_content?(text))
110
111
  end
111
112
  end
112
113
 
113
- Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
114
+ Then /^(?:|I )should (not )?see \/([^\/]*)\/$/ do |negate, regexp|
114
115
  regexp = Regexp.new(regexp)
115
-
116
- if page.respond_to? :should
117
- page.should have_xpath('//*', :text => regexp)
118
- else
119
- assert page.has_xpath?('//*', :text => regexp)
120
- end
121
- end
122
-
123
- Then /^(?:|I )should not see "([^"]*)"$/ do |text|
124
- if page.respond_to? :should
125
- page.should have_no_content(text)
126
- else
127
- assert page.has_no_content?(text)
128
- end
129
- end
130
-
131
- Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
132
- regexp = Regexp.new(regexp)
133
-
134
- if page.respond_to? :should
135
- page.should have_no_xpath('//*', :text => regexp)
116
+ should_name = negate ? :should_not : :should
117
+ if page.respond_to? should_name
118
+ page.send should_name, have_xpath('//*', :text => regexp)
136
119
  else
137
- assert page.has_no_xpath?('//*', :text => regexp)
120
+ assert(negate ? page.has_no_xpath?('//*', :text => regexp) : page.has_xpath?('//*', :text => regexp))
138
121
  end
139
122
  end
140
123
 
141
- Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
142
- with_scope(parent) do
143
- field = find_field(field)
144
- if field.value.respond_to? :should
145
- field.value.should =~ /#{value}/
146
- else
147
- assert_match(/#{value}/, field.value)
148
- end
149
- end
150
- end
151
-
152
- Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
153
- with_scope(parent) do
154
- field = find_field(field)
155
- if field.value.respond_to? :should_not
156
- field.value.should_not =~ /#{value}/
157
- else
158
- assert_no_match(/#{value}/, field.value)
159
- end
160
- end
161
- end
162
-
163
- Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
164
- with_scope(parent) do
165
- field_checked = find_field(label)['checked']
166
- if field_checked.respond_to? :should
167
- field_checked.should be_true
168
- else
169
- assert field_checked
170
- end
171
- end
172
- end
173
-
174
- Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
175
- with_scope(parent) do
176
- field_checked = find_field(label)['checked']
177
- if field_checked.respond_to? :should
178
- field_checked.should be_false
179
- else
180
- assert !field_checked
181
- end
182
- end
183
- end
184
-
185
124
  Then /^(?:|I )should be on (.+)$/ do |page_name|
186
125
  current_path = URI.parse(current_url).path
187
126
  if current_path.respond_to? :should
@@ -195,8 +134,8 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
195
134
  query = URI.parse(current_url).query
196
135
  actual_params = query ? CGI.parse(query) : {}
197
136
  expected_params = {}
198
- expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
199
-
137
+ expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
138
+
200
139
  if actual_params.respond_to? :should
201
140
  actual_params.should == expected_params
202
141
  else
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "mime-types", "< 2.0", :platform=>:ruby_18
6
+ gem "rubyzip", "< 1.0", :platform=>:ruby_18
5
7
  gem "rails", "~> 2.3.0"
6
8
  gem "activerecord-tableless", :path=>"../"
7
9
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "mime-types", "< 2.0", :platform=>:ruby_18
6
+ gem "rubyzip", "< 1.0", :platform=>:ruby_18
5
7
  gem "rails", "~> 3.0.0"
6
8
  gem "activerecord-tableless", :path=>"../"
7
9
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "mime-types", "< 2.0", :platform=>:ruby_18
6
+ gem "rubyzip", "< 1.0", :platform=>:ruby_18
5
7
  gem "rails", "~> 3.2.0"
6
8
  gem "jquery-rails"
7
9
  gem "activerecord-tableless", :path=>"../"
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "mime-types", "< 2.0", :platform=>:ruby_18
6
+ gem "rubyzip", "< 1.0", :platform=>:ruby_18
5
7
  gem "rails", "~> 3.0"
6
8
  gem "jquery-rails"
7
9
  gem "activerecord-tableless", :path=>"../"
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "mime-types", "< 2.0", :platform=>:ruby_18
6
+ gem "rubyzip", "< 1.0", :platform=>:ruby_18
5
7
  gem "rails", "~> 4.0.0"
6
8
  gem "jquery-rails"
7
9
  gem "activerecord-tableless", :path=>"../"
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "mime-types", "< 2.0", :platform=>:ruby_18
6
+ gem "rubyzip", "< 1.0", :platform=>:ruby_18
7
+ gem "rails", "~> 4.1.0"
8
+ gem "jquery-rails"
9
+ gem "activerecord-tableless", :path=>"../"
10
+
11
+ gemspec :path=>"../"
@@ -228,7 +228,7 @@ module ActiveRecord
228
228
  ""
229
229
  end
230
230
 
231
- %w(create create_record update update_record).each do |method_name|
231
+ %w(create create_record _create_record update update_record _update_record).each do |method_name|
232
232
  define_method(method_name) do |*args|
233
233
  case self.class.tableless_options[:database]
234
234
  when :pretend_success
@@ -38,7 +38,7 @@ end
38
38
  ActiveRecord::Base.logger = Logger.new(STDERR)
39
39
  ActiveRecord::Base.logger.level = Logger::Severity::UNKNOWN
40
40
 
41
- shared_examples_for "an active record" do
41
+ shared_examples_for "an active record instance" do
42
42
  it { should respond_to :id }
43
43
  it { should respond_to :id= }
44
44
  it { should respond_to :name }
@@ -62,7 +62,7 @@ shared_examples_for "a nested active record" do
62
62
  specify do
63
63
  (subject.arm_rests << ArmRest.new({:name => 'nice arm_rest'})).should have(1).items
64
64
  end
65
- describe "result" do
65
+ describe "appending two children" do
66
66
  before(:each) do
67
67
  subject.arm_rests << [ArmRest.new({:name => 'left'}),
68
68
  ArmRest.new({:name => 'right'})]
@@ -91,55 +91,55 @@ shared_examples_for "a nested active record" do
91
91
  end
92
92
 
93
93
  shared_examples_for "a tableless model with fail_fast" do
94
- it_behaves_like "an active record"
95
- describe "class" do
96
- case ActiveRecord::VERSION::MAJOR
97
- when 2
98
- describe "#find" do
99
- it "raises ActiveRecord::Tableless::NoDatabase" do
100
- expect { Chair.find(1) }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
101
- end
102
- end
103
- describe "#find(:all)" do
104
- it "raises ActiveRecord::Tableless::NoDatabase" do
105
- expect { Chair.find(:all) }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
106
- end
107
- end
108
- when 3
109
- describe "#all" do
110
- it "raises ActiveRecord::Tableless::NoDatabase" do
111
- expect { Chair.all }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
112
- end
113
- end
114
- when 4
115
- describe "#all" do
116
- it "raises ActiveRecord::Tableless::NoDatabase" do
117
- expect { Chair.all }.to_not raise_exception
118
- end
94
+ case ActiveRecord::VERSION::MAJOR
95
+ when 2
96
+ describe "#find" do
97
+ it "raises ActiveRecord::Tableless::NoDatabase" do
98
+ expect { subject.find(1) }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
119
99
  end
120
- describe "#all[]" do
121
- it "raises ActiveRecord::Tableless::NoDatabase" do
122
- expect { Chair.all[0] }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
123
- end
100
+ end
101
+ describe "#find(:all)" do
102
+ it "raises ActiveRecord::Tableless::NoDatabase" do
103
+ expect { subject.find(:all) }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
124
104
  end
125
105
  end
126
- describe "#create" do
106
+ when 3
107
+ describe "#all" do
127
108
  it "raises ActiveRecord::Tableless::NoDatabase" do
128
- expect { Chair.create(:name => 'Jarl') }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
109
+ expect { subject.all }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
129
110
  end
130
111
  end
131
- describe "#destroy" do
112
+ when 4
113
+ describe "#all" do
132
114
  it "raises ActiveRecord::Tableless::NoDatabase" do
133
- expect { Chair.destroy(1) }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
115
+ expect { subject.all }.to_not raise_exception
134
116
  end
135
117
  end
136
- describe "#destroy_all" do
118
+ describe "#all[]" do
137
119
  it "raises ActiveRecord::Tableless::NoDatabase" do
138
- expect { Chair.destroy_all }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
120
+ expect { subject.all[0] }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
139
121
  end
140
122
  end
141
123
  end
124
+ describe "#create" do
125
+ it "raises ActiveRecord::Tableless::NoDatabase" do
126
+ expect { subject.create(:name => 'Jarl') }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
127
+ end
128
+ end
129
+ describe "#destroy" do
130
+ it "raises ActiveRecord::Tableless::NoDatabase" do
131
+ expect { subject.destroy(1) }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
132
+ end
133
+ end
134
+ describe "#destroy_all" do
135
+ it "raises ActiveRecord::Tableless::NoDatabase" do
136
+ expect { subject.destroy_all }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
137
+ end
138
+ end
139
+ end
142
140
 
141
+ shared_examples_for "a tableless model instance with fail_fast" do
142
+ it_behaves_like "an active record instance"
143
143
  describe "#save" do
144
144
  it "raises ActiveRecord::Tableless::NoDatabase" do
145
145
  expect { subject.save }.to raise_exception(ActiveRecord::Tableless::NoDatabase)
@@ -162,86 +162,98 @@ shared_examples_for "a tableless model with fail_fast" do
162
162
  end
163
163
  end
164
164
 
165
- describe "Tableless with fail_fast" do
165
+ describe "Tableless model with fail_fast" do
166
166
  before(:all) {make_tableless_model(nil, nil)}
167
167
  after(:all){ remove_models }
168
- subject { Chair.new }
168
+ subject { Chair }
169
169
  it_behaves_like "a tableless model with fail_fast"
170
+ describe "instance" do
171
+ subject { Chair.new(:name => 'Jarl') }
172
+ it_behaves_like "a tableless model instance with fail_fast"
173
+ end
170
174
  end
171
175
 
172
176
  describe "Tableless nested with fail_fast" do
173
177
  before(:all) {make_tableless_model(nil, true)}
174
178
  after(:all){ remove_models }
179
+ subject { Chair }
180
+ it_behaves_like "a tableless model with fail_fast"
175
181
  describe "#new" do
176
182
  it "accepts attributes" do
177
- Chair.new(:name => "Jarl").should be_an_instance_of(Chair)
183
+ subject.new(:name => "Jarl").should be_an_instance_of(subject)
178
184
  end
179
185
  it "assign attributes" do
180
- Chair.new(:name => "Jarl").name.should == "Jarl"
186
+ subject.new(:name => "Jarl").name.should == "Jarl"
181
187
  end
182
- describe "with nested models" do
183
- subject do
184
- Chair.new(:name => "Jarl",
185
- :arm_rests => [
186
- ArmRest.new(:name => 'left'),
187
- ArmRest.new(:name => 'right'),
188
- ])
188
+ end
189
+ describe "instance" do
190
+ subject { Chair.new(:name => 'Jarl') }
191
+ it_behaves_like "a tableless model instance with fail_fast"
192
+ it_behaves_like "a nested active record"
193
+ describe "#update_attributes" do
194
+ it "raises ActiveRecord::Tableless::NoDatabase" do
195
+ expect do
196
+ subject.update_attributes(:arm_rests => {:name => 'nice arm_rest'})
197
+ end.to raise_exception(StandardError)
189
198
  end
190
- it {should be_an_instance_of(Chair) }
191
- it {should have(2).arm_rests }
192
199
  end
193
- describe "with nested attributes" do
194
- subject do
195
- Chair.new(:name => "Jarl",
196
- :arm_rests_attributes => [
197
- {:name => 'left'},
198
- {:name => 'right'},
199
- ])
200
- end
201
- it {should be_an_instance_of(Chair)}
202
- it {should have(2).arm_rests }
200
+ end
201
+ describe "instance with nested models" do
202
+ subject do
203
+ Chair.new(:name => "Jarl",
204
+ :arm_rests => [
205
+ ArmRest.new(:name => 'left'),
206
+ ArmRest.new(:name => 'right'),
207
+ ])
203
208
  end
209
+ it {should be_an_instance_of(Chair) }
210
+ it {should have(2).arm_rests }
204
211
  end
205
- subject { Chair.new }
206
- it_behaves_like "a tableless model with fail_fast"
207
- it_behaves_like "a nested active record"
208
- describe "#update_attributes" do
209
- it "raises ActiveRecord::Tableless::NoDatabase" do
210
- expect do
211
- subject.update_attributes(:arm_chair => {:name => 'nice arm_rest'})
212
- end.to raise_exception(StandardError)
212
+ describe "instance with nested attributes" do
213
+ subject do
214
+ Chair.new(:name => "Jarl",
215
+ :arm_rests_attributes => [
216
+ {:name => 'left'},
217
+ {:name => 'right'},
218
+ ])
213
219
  end
220
+ it {should be_an_instance_of(Chair)}
221
+ it {should have(2).arm_rests }
214
222
  end
215
223
  end
216
224
 
217
- shared_examples_for "a succeeding database" do
218
- it_behaves_like "an active record"
219
- describe "class" do
220
- case ActiveRecord::VERSION::MAJOR
221
- when 2
222
- describe "#find" do
223
- it "raises ActiveRecord::RecordNotFound" do
224
- expect { Chair.find(314) }.to raise_exception(ActiveRecord::RecordNotFound)
225
- end
226
- end
227
- describe "#find(:all)" do
228
- specify { Chair.find(:all).should == []}
229
- end
230
- when 3, 4
231
- describe "#all" do
232
- specify { Chair.all.should == []}
225
+ ##
226
+ ## Succeeding database
227
+ ##
228
+ shared_examples_for "a model with succeeding database" do
229
+ case ActiveRecord::VERSION::MAJOR
230
+ when 2
231
+ describe "#find" do
232
+ it "raises ActiveRecord::RecordNotFound" do
233
+ expect { subject.find(314) }.to raise_exception(ActiveRecord::RecordNotFound)
233
234
  end
234
235
  end
235
- describe "#create" do
236
- specify { Chair.create(:name => 'Jarl').should be_an_instance_of(Chair) }
236
+ describe "#find(:all)" do
237
+ specify { subject.find(:all).should == []}
237
238
  end
238
- describe "#destroy" do
239
- specify { Chair.destroy(1).should be_an_instance_of(Chair) }
240
- end
241
- describe "#destroy_all" do
242
- specify { Chair.destroy_all.should == [] }
239
+ when 3, 4
240
+ describe "#all" do
241
+ specify { subject.all.should == []}
243
242
  end
244
243
  end
244
+ describe "#create" do
245
+ specify { subject.create(:name => 'Jarl').should be_an_instance_of(subject) }
246
+ end
247
+ describe "#destroy" do
248
+ specify { subject.destroy(1).should be_an_instance_of(subject) }
249
+ end
250
+ describe "#destroy_all" do
251
+ specify { subject.destroy_all.should == [] }
252
+ end
253
+ end
254
+
255
+ shared_examples_for "an instance with succeeding database" do
256
+ it_behaves_like "an active record instance"
245
257
 
246
258
  describe "#save" do
247
259
  specify { subject.save.should == true }
@@ -258,7 +270,7 @@ shared_examples_for "a succeeding database" do
258
270
  end
259
271
  end
260
272
 
261
- describe "Active record with real database" do
273
+ describe "ActiveRecord with real database" do
262
274
  ##This is only here to ensure that the shared examples are actually behaving like a real database.
263
275
  before(:all) do
264
276
  FileUtils.mkdir_p "tmp"
@@ -274,13 +286,21 @@ describe "Active record with real database" do
274
286
  ActiveRecord::Base.clear_all_connections!
275
287
  end
276
288
 
277
- subject { Chair.new(:name => 'Jarl') }
278
- it_behaves_like "a succeeding database"
289
+ subject { Chair }
290
+ it_behaves_like "a model with succeeding database"
291
+ describe "instance" do
292
+ subject { Chair.new(:name => 'Jarl') }
293
+ it_behaves_like "an instance with succeeding database"
294
+ end
279
295
  end
280
296
 
281
- describe "Tableless with succeeding database" do
297
+ describe "Tableless model with succeeding database" do
282
298
  before(:all) { make_tableless_model(:pretend_success, nil) }
283
299
  after(:all){ remove_models }
284
- subject { Chair.new(:name => 'Jarl') }
285
- it_behaves_like "a succeeding database"
300
+ subject { Chair }
301
+ it_behaves_like "a model with succeeding database"
302
+ describe "instance" do
303
+ subject { Chair.new(:name => 'Jarl') }
304
+ it_behaves_like "an instance with succeeding database"
305
+ end
286
306
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-tableless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarl Friis
@@ -10,160 +10,146 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-03 00:00:00.000000000 Z
13
+ date: 2014-05-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: 2.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: 2.3.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: bundler
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rake
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: sqlite3
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ~>
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
63
  version: '1.3'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ~>
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '1.3'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: appraisal
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ~>
75
+ - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '0.4'
77
+ version: '0.5'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ~>
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
- version: '0.4'
84
+ version: '0.5'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: cucumber
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ~>
89
+ - - "~>"
90
90
  - !ruby/object:Gem::Version
91
91
  version: '1.1'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - ~>
96
+ - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '1.1'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rspec
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">"
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">"
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: aruba
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>='
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0.5'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - '>='
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0.5'
127
- - !ruby/object:Gem::Dependency
128
- name: capybara
129
- requirement: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - '>='
139
- - !ruby/object:Gem::Version
140
- version: '0'
141
127
  - !ruby/object:Gem::Dependency
142
128
  name: nokogiri
143
129
  requirement: !ruby/object:Gem::Requirement
144
130
  requirements:
145
- - - <
131
+ - - "<"
146
132
  - !ruby/object:Gem::Version
147
133
  version: '1.6'
148
134
  type: :development
149
135
  prerelease: false
150
136
  version_requirements: !ruby/object:Gem::Requirement
151
137
  requirements:
152
- - - <
138
+ - - "<"
153
139
  - !ruby/object:Gem::Version
154
140
  version: '1.6'
155
141
  - !ruby/object:Gem::Dependency
156
142
  name: capybara
157
143
  requirement: !ruby/object:Gem::Requirement
158
144
  requirements:
159
- - - <
145
+ - - "<"
160
146
  - !ruby/object:Gem::Version
161
147
  version: '2.1'
162
148
  type: :development
163
149
  prerelease: false
164
150
  version_requirements: !ruby/object:Gem::Requirement
165
151
  requirements:
166
- - - <
152
+ - - "<"
167
153
  - !ruby/object:Gem::Version
168
154
  version: '2.1'
169
155
  description: ActiveRecord Tableless Models provides a simple mixin for creating models
@@ -175,9 +161,9 @@ executables: []
175
161
  extensions: []
176
162
  extra_rdoc_files: []
177
163
  files:
178
- - .gitignore
179
- - .rspec
180
- - .travis.yml
164
+ - ".gitignore"
165
+ - ".rspec"
166
+ - ".travis.yml"
181
167
  - Appraisals
182
168
  - Gemfile
183
169
  - LICENSE.txt
@@ -197,6 +183,7 @@ files:
197
183
  - gemfiles/rails32.gemfile
198
184
  - gemfiles/rails3x.gemfile
199
185
  - gemfiles/rails40.gemfile
186
+ - gemfiles/rails41.gemfile
200
187
  - init.rb
201
188
  - lib/activerecord-tableless.rb
202
189
  - spec/lib/activerecord-tableless_spec.rb
@@ -210,17 +197,17 @@ require_paths:
210
197
  - lib
211
198
  required_ruby_version: !ruby/object:Gem::Requirement
212
199
  requirements:
213
- - - '>='
200
+ - - ">="
214
201
  - !ruby/object:Gem::Version
215
202
  version: '0'
216
203
  required_rubygems_version: !ruby/object:Gem::Requirement
217
204
  requirements:
218
- - - '>='
205
+ - - ">="
219
206
  - !ruby/object:Gem::Version
220
207
  version: '0'
221
208
  requirements: []
222
209
  rubyforge_project:
223
- rubygems_version: 2.0.3
210
+ rubygems_version: 2.2.2
224
211
  signing_key:
225
212
  specification_version: 4
226
213
  summary: A library for implementing tableless ActiveRecord models