rails3_artifactor 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rails3_artifactor/artifact/orm/active_record.rb +1 -1
- data/lib/rails3_artifactor/artifact/orm/data_mapper.rb +1 -1
- data/lib/rails3_artifactor/artifact/orm/mongo_mapper.rb +1 -1
- data/lib/rails3_artifactor/artifact/orm/mongoid.rb +1 -1
- data/rails3_artifactor.gemspec +3 -1
- data/spec/rails3_artifactor/artifact/crud/model_active_record_spec.rb +68 -0
- data/spec/rails3_artifactor/artifact/crud/model_spec.rb +4 -0
- metadata +4 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -11,7 +11,7 @@ module Rails3::Assist::Orm
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def new_model_content name, options={}, &block
|
14
|
-
content = options[:content]
|
14
|
+
content = block ? yield : options[:content]
|
15
15
|
file_w_include(name, orm_marker_name(name, options)) { content }
|
16
16
|
end
|
17
17
|
|
@@ -11,7 +11,7 @@ module Rails3::Assist::Orm
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def new_model_content name, options={}, &block
|
14
|
-
content = options[:content]
|
14
|
+
content = block ? yield : options[:content]
|
15
15
|
file_w_include(name, orm_marker_name(name, options)) { content }
|
16
16
|
end
|
17
17
|
|
data/rails3_artifactor.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails3_artifactor}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
|
|
57
57
|
"spec/rails3_artifactor/artifact/crud/helper_spec.rb",
|
58
58
|
"spec/rails3_artifactor/artifact/crud/mailer_spec.rb",
|
59
59
|
"spec/rails3_artifactor/artifact/crud/migration_spec.rb",
|
60
|
+
"spec/rails3_artifactor/artifact/crud/model_active_record_spec.rb",
|
60
61
|
"spec/rails3_artifactor/artifact/crud/model_spec.rb",
|
61
62
|
"spec/rails3_artifactor/artifact/crud/observer_spec.rb",
|
62
63
|
"spec/rails3_artifactor/artifact/crud/view_controller_action_spec.rb",
|
@@ -90,6 +91,7 @@ Gem::Specification.new do |s|
|
|
90
91
|
"spec/rails3_artifactor/artifact/crud/helper_spec.rb",
|
91
92
|
"spec/rails3_artifactor/artifact/crud/mailer_spec.rb",
|
92
93
|
"spec/rails3_artifactor/artifact/crud/migration_spec.rb",
|
94
|
+
"spec/rails3_artifactor/artifact/crud/model_active_record_spec.rb",
|
93
95
|
"spec/rails3_artifactor/artifact/crud/model_spec.rb",
|
94
96
|
"spec/rails3_artifactor/artifact/crud/observer_spec.rb",
|
95
97
|
"spec/rails3_artifactor/artifact/crud/view_controller_action_spec.rb",
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'model without orm' do
|
4
|
+
use_orm :active_record
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
Rails3::Assist::Directory.rails_root = fixtures_dir
|
8
|
+
|
9
|
+
delete_model(:account) # if has_model? :account
|
10
|
+
create_model :account do
|
11
|
+
%q{def index
|
12
|
+
end}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
after :each do
|
17
|
+
remove_model :account
|
18
|
+
end
|
19
|
+
|
20
|
+
context "Non-existant model(s)" do
|
21
|
+
it "should not fail trying to remove non-existant models" do
|
22
|
+
remove_models :person, :user
|
23
|
+
remove_artifacts :model, :person, :user
|
24
|
+
|
25
|
+
remove_model :person
|
26
|
+
remove_artifact :model, :person
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not find a non-existant model" do
|
30
|
+
model_file :person do |person|
|
31
|
+
fail "should not find person model!"
|
32
|
+
end
|
33
|
+
|
34
|
+
has_model?(:person).should be_false
|
35
|
+
has_models?(:person, :user).should be_false
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should not insert into non-existant model" do
|
39
|
+
insert_into_model(:person, :after => 'Hello', :content => 'Yes').should_not be_true
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should not read from non-existant model" do
|
43
|
+
read_model :person do |content|
|
44
|
+
fail "should not find person content!"
|
45
|
+
end.should_not be_true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should have #index method in :account model' do
|
50
|
+
read_model(:account).should have_method :index
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should have an account_model file that contains an index method and two inserted comments" do
|
54
|
+
insert_into_model :account, :content => '# hello'
|
55
|
+
insert_into_model :account do
|
56
|
+
'# goodbye'
|
57
|
+
end
|
58
|
+
puts read_model(:account)
|
59
|
+
read_model(:account).should have_comment 'hello'
|
60
|
+
|
61
|
+
# root_dir.should have_model :account do |model_file|
|
62
|
+
# model_file.should have_method :index
|
63
|
+
# model_file.should have_comment 'hello'
|
64
|
+
# model_file.should have_comment 'goodbye'
|
65
|
+
# end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
@@ -45,6 +45,10 @@ describe 'model without orm' do
|
|
45
45
|
end.should_not be_true
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
it 'should have #index method in :account model' do
|
50
|
+
read_model(:account).should have_method :index
|
51
|
+
end
|
48
52
|
|
49
53
|
it "should have an account_model file that contains an index method and two inserted comments" do
|
50
54
|
insert_into_model :account, :content => '# hello'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- spec/rails3_artifactor/artifact/crud/helper_spec.rb
|
147
147
|
- spec/rails3_artifactor/artifact/crud/mailer_spec.rb
|
148
148
|
- spec/rails3_artifactor/artifact/crud/migration_spec.rb
|
149
|
+
- spec/rails3_artifactor/artifact/crud/model_active_record_spec.rb
|
149
150
|
- spec/rails3_artifactor/artifact/crud/model_spec.rb
|
150
151
|
- spec/rails3_artifactor/artifact/crud/observer_spec.rb
|
151
152
|
- spec/rails3_artifactor/artifact/crud/view_controller_action_spec.rb
|
@@ -205,6 +206,7 @@ test_files:
|
|
205
206
|
- spec/rails3_artifactor/artifact/crud/helper_spec.rb
|
206
207
|
- spec/rails3_artifactor/artifact/crud/mailer_spec.rb
|
207
208
|
- spec/rails3_artifactor/artifact/crud/migration_spec.rb
|
209
|
+
- spec/rails3_artifactor/artifact/crud/model_active_record_spec.rb
|
208
210
|
- spec/rails3_artifactor/artifact/crud/model_spec.rb
|
209
211
|
- spec/rails3_artifactor/artifact/crud/observer_spec.rb
|
210
212
|
- spec/rails3_artifactor/artifact/crud/view_controller_action_spec.rb
|