socialcast_shoulda_ext 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.3
4
+ env:
5
+ - "activerecord=3.0.0 rails=3.0.0"
6
+ - "activerecord=3.1.0 rails=3.1.0"
7
+ - "activerecord=3.2.0 rails=3.2.0"
8
+ - "activerecord=stable rails=stable"
data/Gemfile CHANGED
@@ -1,13 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
4
-
5
- group :test do
6
- gem 'rails', "~> 3.0.0"
7
- gem 'shoulda', '>= 2.11.3'
8
- gem 'json', ">= 0"
9
- gem 'bundler', ">= 0"
10
- gem 'mocha', ">= 0"
11
- gem 'sqlite3-ruby', "~> 1.3.2"
12
- gem 'ruby-debug', ">= 0"
13
- end
3
+ gemspec
@@ -1,3 +1,4 @@
1
+ {<img src="https://secure.travis-ci.org/socialcast/socialcast-shoulda-ext.png?branch=master" alt="Build Status" />}[http://travis-ci.org/socialcast/socialcast-shoulda-ext]
1
2
 
2
3
  = Socialcast Shoulda Extensions
3
4
  Adds new matchers and functionality to the shoulda test library
@@ -1,4 +1,4 @@
1
1
 
2
2
  module ShouldaExt
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.4"
4
4
  end
@@ -12,8 +12,30 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{adds new shoulda matchers and assertions}
13
13
  s.description = File.read('README.rdoc')
14
14
 
15
- s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0"])
16
- s.add_runtime_dependency(%q<shoulda>, [">= 2.11.1"])
15
+ s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
16
+
17
+ %w[activerecord].each do |lib|
18
+ dep = case ENV[lib]
19
+ when 'stable', nil then nil
20
+ when /(\d+\.)+\d+/ then ["~> " + ENV[lib]]
21
+ else [">= 3.0"]
22
+ end
23
+ s.add_runtime_dependency(lib, dep)
24
+ end
25
+
26
+ %w[rails].each do |lib|
27
+ dep = case ENV[lib]
28
+ when 'stable', nil then nil
29
+ when /(\d+\.)+\d+/ then ["~> " + ENV[lib]]
30
+ else [">= 3.0"]
31
+ end
32
+ s.add_development_dependency(lib, dep)
33
+ end
34
+ s.add_development_dependency 'json', ">= 0"
35
+ s.add_development_dependency 'bundler', ">= 0"
36
+ s.add_development_dependency 'mocha', ">= 0"
37
+ s.add_development_dependency 'sqlite3', "~> 1.3.2"
38
+
17
39
 
18
40
  s.files = `git ls-files`.split("\n")
19
41
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,5 +1,4 @@
1
-
2
- require File.join(File.dirname(__FILE__), 'helper')
1
+ require File.expand_path("#{File.dirname(__FILE__)}/helper")
3
2
 
4
3
  class TestAssertions < Test::Unit::TestCase
5
4
  def test_assert_blank
@@ -1,5 +1,4 @@
1
-
2
- require File.join(File.dirname(__FILE__), 'helper')
1
+ require File.expand_path("#{File.dirname(__FILE__)}/helper")
3
2
 
4
3
  class TestRecordCountChangeMatcher < Test::Unit::TestCase
5
4
  def create_blog(n = 1)
@@ -1,13 +1,14 @@
1
-
2
- require File.join(File.dirname(__FILE__), 'helper')
1
+ require File.expand_path("#{File.dirname(__FILE__)}/helper")
3
2
 
4
3
  class TestRespondWithJson < ActionController::TestCase
4
+ setup do
5
+ @controller = BlogsController.new
6
+ @request = ActionController::TestRequest.new
7
+ @response = ActionController::TestResponse.new
8
+ end
9
+
5
10
  context "blogs controller" do
6
- setup do
7
- @controller = BlogsController.new
8
- @request = ActionController::TestRequest.new
9
- @response = ActionController::TestResponse.new
10
- end
11
+ subject { @controller }
11
12
 
12
13
  context ":index.json and block test" do
13
14
  setup do
@@ -1,5 +1,4 @@
1
-
2
- require File.join(File.dirname(__FILE__), 'helper')
1
+ require File.expand_path("#{File.dirname(__FILE__)}/helper")
3
2
 
4
3
  class TestTriggerCallbackMatcher < Test::Unit::TestCase
5
4
 
metadata CHANGED
@@ -1,194 +1,147 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: socialcast_shoulda_ext
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Geoffrey Hichborn
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-06 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: activerecord
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-04-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: &2169286140 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 7
29
- segments:
30
- - 3
31
- - 0
32
- - 0
33
- version: 3.0.0
20
+ - !ruby/object:Gem::Version
21
+ version: 2.11.3
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: shoulda
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2169286140
25
+ - !ruby/object:Gem::Dependency
26
+ name: activerecord
27
+ requirement: &2169285020 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 33
45
- segments:
46
- - 2
47
- - 11
48
- - 1
49
- version: 2.11.1
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
50
33
  type: :runtime
51
- version_requirements: *id002
52
- description: |
53
-
54
- = Socialcast Shoulda Extensions
55
- Adds new matchers and functionality to the shoulda test library
56
-
57
- = Installation
58
-
59
- In your Gemfile:
60
-
61
- group :test do
62
- gem 'socialcast_shoulda_ext', :git => 'git@github.com:socialcast/socialcast-shoulda-ext.git', :require => 'shoulda_ext'
63
- end
64
-
65
- If you want to include the trigger_callbacks matcher, also add the following to your test helper:
66
-
67
- ShouldaExt::Matchers::TriggerCallbackMatcher.attach_active_record_callback_hooks!
68
-
69
- = Matchers
70
-
71
- == RecordCountChangeMatcher
72
- Test if the count for a model has changed, and by how much. Requires the context_with_matcher_before_hooks patch, which is included by default.
73
-
74
- Provides the following matcher methods:
75
-
76
- - create_record(klass_or_symbol)
77
- Alias for change_record_count.for(klass_or_symbol).by(1)
78
-
79
- - create_records(klass_or_symbol, amount)
80
- Alias for change_record_count.for(klass_or_symbol).by(amount)
81
-
82
- - destroy_record(klass_or_symbol)
83
- Alias for change_record_count.for(klass_or_symbol).by(-1)
84
-
85
- - destroy_records(klass_or_symbol, amount)
86
- Alias for change_record_count.for(klass_or_symbol).by(-amount)
87
-
88
- - change_record_count
89
- Tests the difference in record count before and after the current setup/subject block
90
- Can be used with the follow methods:
91
- - for(klass_or_symbol)
92
- Provides the class which the test is being performed on. Can be a constant or a symbol
93
-
94
- - by(amount)
95
- Provides an expected difference for the number of records for the specified class.
96
- Excluding this number will allow the matcher to check for any difference
97
-
98
- Examples:
99
-
100
- context "creating a blog article" do
101
-
102
- context "with good parameters" do
103
- setup do
104
- post :create, :blog => {:title => 'my blog post', :body => 'Ipsum lorem...'}
105
- end
106
- should create_record :blog
107
- end
108
-
109
- context "without a body" do
110
- setup do
111
- post :create, :blog => {:title => 'my blog post' }
112
- end
113
- should_not create_record Blog
114
- end
115
-
116
- end
117
-
118
- == RespondWithJson
119
- Check if the controller's response is json
120
-
121
- Examples:
122
-
123
- context ":index.json" do
124
- setup do
125
- get :index, :format => 'json'
126
- end
127
- # Just check to see that the response was json
128
- should respond_with_json
129
-
130
- # Evaluate the hash produced by the json yourself
131
- should respond_with_json { |json| json.first['blog']['title'] == 'blog post 1'}
132
-
133
- # Provide an exact match
134
- should respond_with_json.exactly(['blog' => {'id' => 1, 'title' => 'blog post 1'}])
135
-
136
- # Provide an exact match with a block
137
- should response_with_json.exactly{ |json| JSON.parse(Blog.all.to_json)}
138
- end
139
-
140
- context ":index.html" do
141
- setup do
142
- get :index
143
- end
144
-
145
- # or the negation
146
- should_not respond_with_json
147
- end
148
-
149
- == TriggerCallbackMatcher
150
-
151
- Test if create, update, destroy, or save callbacks were triggered.
152
-
153
- Requires running
154
- ShouldaExt::Matchers::TriggerCallbackMatcher.attach_active_record_callback_hooks!
155
- in your test suite in order to work properly.
156
-
157
- Examples:
158
-
159
- context "doing nothing to a record" do
160
- subject { Blog.new :title => 'blog title' }
161
- should_not trigger_callbacks
162
- end
163
-
164
- context "creating a record" do
165
- subject { Blog.create! :title => 'blog title' }
166
- should trigger_callbacks.for :create
167
- should_not trigger_callbacks.for :update, :destroy
168
- end
169
-
170
- = Integrations
171
-
172
- Currently only integrates with test/unit. RSpec support to come.
173
-
174
- = Shoulda Extensions
175
-
176
- == ContextWithMatcherBeforeHooks
177
-
178
- Adds the ability to define a 'before' method on any method which will be run before each context's setup/subject block. Used by RecordCountChangeMatcher to record the number of records before the tested operation takes place.
179
-
180
- email:
34
+ prerelease: false
35
+ version_requirements: *2169285020
36
+ - !ruby/object:Gem::Dependency
37
+ name: rails
38
+ requirement: &2169283620 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2169283620
47
+ - !ruby/object:Gem::Dependency
48
+ name: json
49
+ requirement: &2169281840 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2169281840
58
+ - !ruby/object:Gem::Dependency
59
+ name: bundler
60
+ requirement: &2169278820 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2169278820
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: &2169277840 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2169277840
80
+ - !ruby/object:Gem::Dependency
81
+ name: sqlite3
82
+ requirement: &2169276600 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.3.2
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2169276600
91
+ description: ! "{<img src=\"https://secure.travis-ci.org/socialcast/socialcast-shoulda-ext.png?branch=master\"
92
+ alt=\"Build Status\" />}[http://travis-ci.org/socialcast/socialcast-shoulda-ext]\n\n=
93
+ Socialcast Shoulda Extensions\nAdds new matchers and functionality to the shoulda
94
+ test library\n\n= Installation\n\nIn your Gemfile:\n\n group :test do\n gem
95
+ 'socialcast_shoulda_ext', :git => 'git@github.com:socialcast/socialcast-shoulda-ext.git',
96
+ :require => 'shoulda_ext'\n end\n \nIf you want to include the trigger_callbacks
97
+ matcher, also add the following to your test helper:\n\n ShouldaExt::Matchers::TriggerCallbackMatcher.attach_active_record_callback_hooks!\n\n=
98
+ Matchers\n\n== RecordCountChangeMatcher\nTest if the count for a model has changed,
99
+ and by how much. Requires the context_with_matcher_before_hooks patch, which is
100
+ included by default.\n\nProvides the following matcher methods:\n\n- create_record(klass_or_symbol)\n
101
+ \ Alias for change_record_count.for(klass_or_symbol).by(1)\n\n- create_records(klass_or_symbol,
102
+ amount)\n Alias for change_record_count.for(klass_or_symbol).by(amount)\n\n- destroy_record(klass_or_symbol)\n
103
+ \ Alias for change_record_count.for(klass_or_symbol).by(-1)\n\n- destroy_records(klass_or_symbol,
104
+ amount) \n Alias for change_record_count.for(klass_or_symbol).by(-amount)\n\n-
105
+ change_record_count\n Tests the difference in record count before and after the
106
+ current setup/subject block\n Can be used with the follow methods:\n - for(klass_or_symbol)\n
107
+ \ Provides the class which the test is being performed on. Can be a constant
108
+ or a symbol\n\n - by(amount)\n Provides an expected difference for the number
109
+ of records for the specified class.\n Excluding this number will allow the matcher
110
+ to check for any difference\n\nExamples:\n\n context \"creating a blog article\"
111
+ do\n\n context \"with good parameters\" do\n setup do\n post :create,
112
+ :blog => {:title => 'my blog post', :body => 'Ipsum lorem...'}\n end\n should
113
+ create_record :blog\n end\n\n context \"without a body\" do\n setup do\n
114
+ \ post :create, :blog => {:title => 'my blog post' }\n end\n should_not
115
+ create_record Blog\n end\n\n end\n \n== RespondWithJson\nCheck if the controller's
116
+ response is json\n \nExamples:\n\n context \":index.json\" do\n setup do\n
117
+ \ get :index, :format => 'json'\n end\n # Just check to see that the response
118
+ was json\n should respond_with_json \n\n # Evaluate the hash produced by
119
+ the json yourself\n should respond_with_json { |json| json.first['blog']['title']
120
+ == 'blog post 1'}\n \n # Provide an exact match\n should respond_with_json.exactly(['blog'
121
+ => {'id' => 1, 'title' => 'blog post 1'}])\n\n # Provide an exact match with
122
+ a block\n should response_with_json.exactly{ |json| JSON.parse(Blog.all.to_json)}\n
123
+ \ end\n \n context \":index.html\" do\n setup do\n get :index\n end\n
124
+ \n # or the negation\n should_not respond_with_json\n end\n\n== TriggerCallbackMatcher\n\nTest
125
+ if create, update, destroy, or save callbacks were triggered.\n\nRequires running\nShouldaExt::Matchers::TriggerCallbackMatcher.attach_active_record_callback_hooks!\nin
126
+ your test suite in order to work properly.\n\nExamples:\n\n context \"doing nothing
127
+ to a record\" do\n subject { Blog.new :title => 'blog title' }\n should_not
128
+ trigger_callbacks\n end\n\n context \"creating a record\" do\n subject { Blog.create!
129
+ :title => 'blog title' }\n should trigger_callbacks.for :create\n should_not
130
+ trigger_callbacks.for :update, :destroy\n end\n\n= Integrations\n\nCurrently only
131
+ integrates with test/unit. RSpec support to come.\n\n= Shoulda Extensions\n\n==
132
+ ContextWithMatcherBeforeHooks\n\nAdds the ability to define a 'before' method on
133
+ any method which will be run before each context's setup/subject block. Used by
134
+ RecordCountChangeMatcher to record the number of records before the tested operation
135
+ takes place.\n"
136
+ email:
181
137
  - geoff@socialcast.com
182
138
  executables: []
183
-
184
139
  extensions: []
185
-
186
140
  extra_rdoc_files: []
187
-
188
- files:
141
+ files:
189
142
  - .gitignore
143
+ - .travis.yml
190
144
  - Gemfile
191
- - Gemfile.lock
192
145
  - MIT-LICENSE
193
146
  - README.rdoc
194
147
  - Rakefile
@@ -266,38 +219,29 @@ files:
266
219
  - test/test_trigger_callback_matcher.rb
267
220
  homepage: http://github.com/socialcast/socialcast-shoulda-ext
268
221
  licenses: []
269
-
270
222
  post_install_message:
271
223
  rdoc_options: []
272
-
273
- require_paths:
224
+ require_paths:
274
225
  - lib
275
- required_ruby_version: !ruby/object:Gem::Requirement
226
+ required_ruby_version: !ruby/object:Gem::Requirement
276
227
  none: false
277
- requirements:
278
- - - ">="
279
- - !ruby/object:Gem::Version
280
- hash: 3
281
- segments:
282
- - 0
283
- version: "0"
284
- required_rubygems_version: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ! '>='
230
+ - !ruby/object:Gem::Version
231
+ version: '0'
232
+ required_rubygems_version: !ruby/object:Gem::Requirement
285
233
  none: false
286
- requirements:
287
- - - ">="
288
- - !ruby/object:Gem::Version
289
- hash: 3
290
- segments:
291
- - 0
292
- version: "0"
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
293
238
  requirements: []
294
-
295
239
  rubyforge_project:
296
240
  rubygems_version: 1.8.10
297
241
  signing_key:
298
242
  specification_version: 3
299
243
  summary: adds new shoulda matchers and assertions
300
- test_files:
244
+ test_files:
301
245
  - test/helper.rb
302
246
  - test/rails3_root/.gitignore
303
247
  - test/rails3_root/Rakefile