rspec_candy 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rspec_candy/helpers/rails/create_without_callbacks.rb +5 -1
- data/lib/rspec_candy/version.rb +1 -1
- data/spec/shared/app_root/app/models/sti_child.rb +3 -0
- data/spec/shared/app_root/app/models/sti_parent.rb +12 -0
- data/spec/shared/app_root/db/migrate/003_create_sti_model.rb +14 -0
- data/spec/shared/rspec_candy/helpers/rails/create_without_callbacks_spec.rb +10 -0
- metadata +6 -3
@@ -8,7 +8,11 @@ module RSpecCandy
|
|
8
8
|
plain_model = Class.new(ActiveRecord::Base) do
|
9
9
|
self.table_name = table_name
|
10
10
|
end
|
11
|
-
plain_record = plain_model.
|
11
|
+
plain_record = plain_model.new(*args)
|
12
|
+
if plain_record.respond_to?(:type=)
|
13
|
+
plain_record.type = name
|
14
|
+
end
|
15
|
+
plain_record.save!
|
12
16
|
find plain_record.id
|
13
17
|
end
|
14
18
|
|
data/lib/rspec_candy/version.rb
CHANGED
@@ -24,6 +24,16 @@ describe RSpecCandy::Helpers::Rails::CreateWithoutCallbacks do
|
|
24
24
|
record.should_not be_new_record
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'should work with single table inheritance' do
|
28
|
+
child = StiChild.create_without_callbacks(:string_field => 'foo')
|
29
|
+
child.string_field.should == 'foo'
|
30
|
+
child.should be_a(StiChild)
|
31
|
+
child.id.should be_a(Fixnum)
|
32
|
+
child.type.should == 'StiChild'
|
33
|
+
child.should_not be_new_record
|
34
|
+
StiChild.all.should == [child]
|
35
|
+
end
|
36
|
+
|
27
37
|
end
|
28
38
|
|
29
39
|
describe '.new_and_store' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_candy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Henning Koch
|
@@ -105,9 +105,12 @@ files:
|
|
105
105
|
- spec/shared/app_root/app/controllers/application_controller.rb
|
106
106
|
- spec/shared/app_root/app/models/model.rb
|
107
107
|
- spec/shared/app_root/app/models/state_machine_model.rb
|
108
|
+
- spec/shared/app_root/app/models/sti_child.rb
|
109
|
+
- spec/shared/app_root/app/models/sti_parent.rb
|
108
110
|
- spec/shared/app_root/config/initializers/state_machine.rb
|
109
111
|
- spec/shared/app_root/db/migrate/001_create_model.rb
|
110
112
|
- spec/shared/app_root/db/migrate/002_create_state_machine_model.rb
|
113
|
+
- spec/shared/app_root/db/migrate/003_create_sti_model.rb
|
111
114
|
- spec/shared/rspec_candy/helpers/disposable_copy_spec.rb
|
112
115
|
- spec/shared/rspec_candy/helpers/it_should_act_like_spec.rb
|
113
116
|
- spec/shared/rspec_candy/helpers/new_with_stubs_spec.rb
|