objective_spec 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.authors = ["Blake Watters"]
|
12
12
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
13
|
end
|
14
|
-
|
14
|
+
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
16
16
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
17
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -4,46 +4,46 @@ describe <%= class_name %>Controller do
|
|
4
4
|
describe "handling GET /<%= table_name %>" do
|
5
5
|
|
6
6
|
it "should be successful" do
|
7
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
8
|
-
<%= class_name.singularize %>.stub!(:find).and_return([<%= file_name %>])
|
7
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
8
|
+
<%= class_name.singularize %>.stub!(:find).and_return([<%= file_name.singularize %>])
|
9
9
|
get :index, :format => 'xml'
|
10
10
|
response.should be_success
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should find all <%= table_name %>" do
|
14
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
15
|
-
<%= class_name.singularize %>.should_receive(:find).with(:all).and_return([<%= file_name %>])
|
14
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
15
|
+
<%= class_name.singularize %>.should_receive(:find).with(:all).and_return([<%= file_name.singularize %>])
|
16
16
|
get :index, :format => 'xml'
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should assign the found <%= table_name %> for the view" do
|
20
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
21
|
-
<%= class_name.singularize %>.stub!(:find).and_return([<%= file_name %>])
|
20
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
21
|
+
<%= class_name.singularize %>.stub!(:find).and_return([<%= file_name.singularize %>])
|
22
22
|
get :index, :format => 'xml'
|
23
|
-
assigns[:<%=
|
23
|
+
assigns[:<%= file_name.singularize %>].should == [<%= file_name.singularize %>]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "handling GET /<%= table_name %>/1" do
|
28
28
|
|
29
29
|
it "should be successful" do
|
30
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
31
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
30
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
31
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
32
32
|
get :show, :id => "1", :format => 'xml'
|
33
33
|
response.should be_success
|
34
34
|
end
|
35
35
|
|
36
|
-
it "should find the <%= file_name %> requested" do
|
37
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
38
|
-
<%= class_name.singularize %>.should_receive(:find).with("1").and_return(<%= file_name %>)
|
36
|
+
it "should find the <%= file_name.singularize %> requested" do
|
37
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
38
|
+
<%= class_name.singularize %>.should_receive(:find).with("1").and_return(<%= file_name.singularize %>)
|
39
39
|
get :show, :id => "1", :format => 'xml'
|
40
40
|
end
|
41
41
|
|
42
|
-
it "should assign the found <%= file_name %> for the view" do
|
43
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
44
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
42
|
+
it "should assign the found <%= file_name.singularize %> for the view" do
|
43
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
44
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
45
45
|
get :show, :id => "1", :format => 'xml'
|
46
|
-
assigns[:<%= file_name %>].should equal(<%= file_name %>)
|
46
|
+
assigns[:<%= file_name.singularize %>].should equal(<%= file_name.singularize %>)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -51,19 +51,19 @@ describe <%= class_name %>Controller do
|
|
51
51
|
|
52
52
|
describe "with successful save" do
|
53
53
|
|
54
|
-
it "should create a new <%= file_name %>" do
|
55
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
56
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
57
|
-
<%= class_name.singularize %>.should_receive(:new).with({}).and_return(<%= file_name %>)
|
58
|
-
<%= file_name %>.should_receive(:save).and_return(true)
|
59
|
-
post :create, :<%= file_name %> => {}, :format => 'xml'
|
54
|
+
it "should create a new <%= file_name.singularize %>" do
|
55
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
56
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
57
|
+
<%= class_name.singularize %>.should_receive(:new).with({}).and_return(<%= file_name.singularize %>)
|
58
|
+
<%= file_name.singularize %>.should_receive(:save).and_return(true)
|
59
|
+
post :create, :<%= file_name.singularize %> => {}, :format => 'xml'
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should be successful" do
|
63
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
64
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
65
|
-
<%= class_name.singularize %>.stub!(:new).and_return(<%= file_name %>)
|
66
|
-
<%= file_name %>.should_receive(:save).and_return(true)
|
63
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
64
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
65
|
+
<%= class_name.singularize %>.stub!(:new).and_return(<%= file_name.singularize %>)
|
66
|
+
<%= file_name.singularize %>.should_receive(:save).and_return(true)
|
67
67
|
post :create, :<%= file_name %> => {}, :format => 'xml'
|
68
68
|
response.should be_success
|
69
69
|
end
|
@@ -73,21 +73,21 @@ describe <%= class_name %>Controller do
|
|
73
73
|
describe "with failed save" do
|
74
74
|
|
75
75
|
it "should be unprocessable" do
|
76
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
77
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
78
|
-
<%= class_name.singularize %>.stub!(:new).and_return(<%= file_name %>)
|
79
|
-
<%= file_name %>.should_receive(:save).and_return(false)
|
80
|
-
post :create, :<%= file_name %> => {}, :format => 'xml'
|
76
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
77
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
78
|
+
<%= class_name.singularize %>.stub!(:new).and_return(<%= file_name.singularize %>)
|
79
|
+
<%= file_name.singularize %>.should_receive(:save).and_return(false)
|
80
|
+
post :create, :<%= file_name.singularize %> => {}, :format => 'xml'
|
81
81
|
response.code.should == '422'
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should return errors" do
|
85
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
86
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
87
|
-
<%= class_name.singularize %>.stub!(:new).and_return(<%= file_name %>)
|
88
|
-
<%= file_name %>.should_receive(:save).and_return(false)
|
89
|
-
post :create, :<%= file_name %> => {}, :format => 'xml'
|
90
|
-
Nokogiri::XML(response.
|
85
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
86
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
87
|
+
<%= class_name.singularize %>.stub!(:new).and_return(<%= file_name.singularize %>)
|
88
|
+
<%= file_name.singularize %>.should_receive(:save).and_return(false)
|
89
|
+
post :create, :<%= file_name.singularize %> => {}, :format => 'xml'
|
90
|
+
Nokogiri::XML(response.body).at('errors').should_not be_nil
|
91
91
|
end
|
92
92
|
|
93
93
|
end
|
@@ -97,37 +97,37 @@ describe <%= class_name %>Controller do
|
|
97
97
|
|
98
98
|
describe "with successful update" do
|
99
99
|
|
100
|
-
it "should find the <%= file_name %> requested" do
|
101
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
102
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
103
|
-
<%= class_name.singularize %>.should_receive(:find).with("1").and_return(<%= file_name %>)
|
104
|
-
<%= file_name %>.should_receive(:update_attributes).and_return(true)
|
100
|
+
it "should find the <%= file_name.singularize %> requested" do
|
101
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
102
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
103
|
+
<%= class_name.singularize %>.should_receive(:find).with("1").and_return(<%= file_name.singularize %>)
|
104
|
+
<%= file_name.singularize %>.should_receive(:update_attributes).and_return(true)
|
105
105
|
put :update, :id => "1", :format => 'xml'
|
106
106
|
end
|
107
107
|
|
108
|
-
it "should update the found <%= file_name %>" do
|
109
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
110
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
111
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
112
|
-
<%= file_name %>.should_receive(:update_attributes).and_return(true)
|
108
|
+
it "should update the found <%= file_name.singularize %>" do
|
109
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
110
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
111
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
112
|
+
<%= file_name.singularize %>.should_receive(:update_attributes).and_return(true)
|
113
113
|
put :update, :id => "1", :format => 'xml'
|
114
|
-
assigns(:<%= file_name %>).should equal(<%= file_name %>)
|
114
|
+
assigns(:<%= file_name.singularize %>).should equal(<%= file_name.singularize %>)
|
115
115
|
end
|
116
116
|
|
117
|
-
it "should assign the found <%= file_name %> for the view" do
|
118
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
119
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
120
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
121
|
-
<%= file_name %>.should_receive(:update_attributes).and_return(true)
|
117
|
+
it "should assign the found <%= file_name.singularize %> for the view" do
|
118
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
119
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
120
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
121
|
+
<%= file_name.singularize %>.should_receive(:update_attributes).and_return(true)
|
122
122
|
put :update, :id => "1", :format => 'xml'
|
123
|
-
assigns(:<%= file_name %>).should equal(<%= file_name %>)
|
123
|
+
assigns(:<%= file_name.singularize %>).should equal(<%= file_name.singularize %>)
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should be successful" do
|
127
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
128
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
129
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
130
|
-
<%= file_name %>.should_receive(:update_attributes).and_return(true)
|
127
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
128
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
129
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
130
|
+
<%= file_name.singularize %>.should_receive(:update_attributes).and_return(true)
|
131
131
|
put :update, :id => "1", :format => 'xml'
|
132
132
|
response.should be_success
|
133
133
|
end
|
@@ -137,10 +137,10 @@ describe <%= class_name %>Controller do
|
|
137
137
|
describe "with failed update" do
|
138
138
|
|
139
139
|
it "should render errors" do
|
140
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
141
|
-
<%= file_name %>.stub!(:to_param).and_return("1")
|
142
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
143
|
-
<%= file_name %>.should_receive(:update_attributes).and_return(false)
|
140
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
141
|
+
<%= file_name.singularize %>.stub!(:to_param).and_return("1")
|
142
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
143
|
+
<%= file_name.singularize %>.should_receive(:update_attributes).and_return(false)
|
144
144
|
put :update, :id => "1", :format => 'xml'
|
145
145
|
Nokogiri::XML(response.body).at('errors').should_not be_nil
|
146
146
|
end
|
@@ -151,23 +151,23 @@ describe <%= class_name %>Controller do
|
|
151
151
|
describe "handling DELETE /<%= table_name %>/1" do
|
152
152
|
|
153
153
|
it "should find the <%= file_name %> requested" do
|
154
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
155
|
-
<%= file_name %>.stub!(:destroy).and_return(true)
|
156
|
-
<%= class_name.singularize %>.should_receive(:find).with("1").and_return(<%= file_name %>)
|
154
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
155
|
+
<%= file_name.singularize %>.stub!(:destroy).and_return(true)
|
156
|
+
<%= class_name.singularize %>.should_receive(:find).with("1").and_return(<%= file_name.singularize %>)
|
157
157
|
delete :destroy, :id => "1", :format => 'xml'
|
158
158
|
end
|
159
159
|
|
160
160
|
it "should call destroy on the found <%= file_name %>" do
|
161
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
162
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
163
|
-
<%= file_name %>.should_receive(:destroy).and_return(true)
|
161
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
162
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
163
|
+
<%= file_name.singularize %>.should_receive(:destroy).and_return(true)
|
164
164
|
delete :destroy, :id => "1", :format => 'xml'
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should succeed" do
|
168
|
-
<%= file_name %> = Factory(:<%= file_name %>)
|
169
|
-
<%= file_name %>.stub!(:destroy).and_return(true)
|
170
|
-
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name %>)
|
168
|
+
<%= file_name.singularize %> = Factory(:<%= file_name.singularize %>)
|
169
|
+
<%= file_name.singularize %>.stub!(:destroy).and_return(true)
|
170
|
+
<%= class_name.singularize %>.stub!(:find).and_return(<%= file_name.singularize %>)
|
171
171
|
delete :destroy, :id => "1", :format => 'xml'
|
172
172
|
response.should be_success
|
173
173
|
end
|
@@ -14,13 +14,12 @@ INFO
|
|
14
14
|
def manifest
|
15
15
|
record do |m|
|
16
16
|
m.directory 'spec/mailers'
|
17
|
-
m.directory 'spec/
|
18
|
-
m.
|
19
|
-
m.file 'spec_helpers/
|
20
|
-
m.file 'spec_helpers/
|
21
|
-
m.file 'spec_helpers/
|
22
|
-
m.file 'spec_helpers/
|
23
|
-
m.file 'spec_helpers/shared_examples.rb', 'spec/spec_helpers/shared_examples.rb'
|
17
|
+
m.directory 'spec/support'
|
18
|
+
m.file 'spec_helpers/common.rb', 'spec/support/common_spec_helper.rb'
|
19
|
+
m.file 'spec_helpers/model.rb', 'spec/support/model_spec_helper.rb'
|
20
|
+
m.file 'spec_helpers/view.rb', 'spec/support/view_spec_helper.rb'
|
21
|
+
m.file 'spec_helpers/controller.rb', 'spec/support/controller_spec_helper.rb'
|
22
|
+
m.file 'spec_helpers/shared_examples.rb', 'spec/support/shared_examples.rb'
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
data/objective_spec.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{objective_spec}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Blake Watters"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-29}
|
13
13
|
s.email = %q{blake@objective3.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -93,3 +93,4 @@ Gem::Specification.new do |s|
|
|
93
93
|
else
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: objective_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Watters
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-29 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|