remarkable_rails 3.0.8 → 3.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  # v3.0
23
23
 
24
- [ENHANCEMENT] redirect_to and render_template were ported from rspec-rails to
24
+ * redirect_to and render_template were ported from rspec-rails to
25
25
  remarkable to provide I18n. The second was also extended to deal with :with,
26
26
  :layout and :content_type as options.
27
27
 
@@ -34,7 +34,7 @@ respond_with matcher, so they also share the same options.
34
34
  :set_the_flash was also redesign to inherit from :set_session, providing a
35
35
  consistent API.
36
36
 
37
- [ENHANCEMENT] remarkable_rails now ships with a new feature, called macro stubs.
37
+ * remarkable_rails now ships with a new feature, called macro stubs.
38
38
  This allows you to declare just once your mocks and/or expectations, and each
39
39
  matcher will know how to deal with properly. A TasksController could have your
40
40
  specs for a create action rewritten like this:
@@ -59,5 +59,5 @@ For more options, information and configuration, check macro stubs documentation
59
59
 
60
60
  # v2.x
61
61
 
62
- [ENHANCMENT] Added assign_to, filter_params, render_with_layout, respond_with
62
+ * Added assign_to, filter_params, render_with_layout, respond_with
63
63
  respond_with_content_type, route, set_session and set_the_flash matchers.
@@ -354,7 +354,7 @@ module Remarkable
354
354
  verb = verb.to_s
355
355
 
356
356
  description = Remarkable.t 'remarkable.action_controller.responding',
357
- :default => "responding to ##{verb.upcase} #{action}",
357
+ :default => "responding to \#{{verb}} {{action}}",
358
358
  :verb => verb.sub('!', '').upcase, :action => action
359
359
 
360
360
  send_args = [ verb, action, options ]
@@ -2,9 +2,11 @@ module Remarkable
2
2
  module ActionController
3
3
  module Matchers
4
4
  class AssignToMatcher < Remarkable::ActionController::Base #:nodoc:
5
- arguments :collection => :names, :as => :name, :block => :block
5
+ arguments :collection => :names, :as => :name, :block => true
6
+
7
+ optional :with, :block => true
8
+ optional :with_kind_of
6
9
 
7
- optional :with, :with_kind_of
8
10
  collection_assertions :assigned_value?, :is_kind_of?, :is_equal_value?
9
11
 
10
12
  before_assert :evaluate_expected_value
@@ -31,8 +31,8 @@ module Remarkable
31
31
  # it { should filter_params(:password) }
32
32
  # it { should_not filter_params(:username) }
33
33
  #
34
- def filter_params(*params)
35
- FilterParamsMatcher.new(*params).spec(self)
34
+ def filter_params(*params, &block)
35
+ FilterParamsMatcher.new(*params, &block).spec(self)
36
36
  end
37
37
  alias :filter_param :filter_params
38
38
 
@@ -4,8 +4,8 @@ module Remarkable
4
4
  class RedirectToMatcher < Remarkable::ActionController::Base #:nodoc:
5
5
  include ::ActionController::StatusCodes
6
6
 
7
- arguments :expected, :block => :block
8
- optional :with
7
+ arguments :expected, :block => true
8
+ optional :with, :block => true
9
9
 
10
10
  assertions :redirected?, :status_matches?, :url_matches?
11
11
 
@@ -4,7 +4,6 @@ module Remarkable
4
4
  module ActionController
5
5
  module Matchers
6
6
  class RenderTemplateMatcher < RespondWithMatcher #:nodoc:
7
-
8
7
  prepend_optional :template, :layout
9
8
 
10
9
  assertions :rendered?, :template_matches?, :layout_matches?
@@ -122,24 +121,24 @@ module Remarkable
122
121
  #
123
122
  # Extensions check does not work in Rails 2.1.x.
124
123
  #
125
- def render_template(*args)
124
+ def render_template(*args, &block)
126
125
  options = args.extract_options!
127
- RenderTemplateMatcher.new(options.merge(:template => args.first)).spec(self)
126
+ RenderTemplateMatcher.new(options.merge(:template => args.first), &block).spec(self)
128
127
  end
129
128
 
130
129
  # This is just a shortcut for render_template :layout => layout. It's also
131
130
  # used for Shoulda compatibility. Check render_template for more information.
132
131
  #
133
- def render_with_layout(*args)
132
+ def render_with_layout(*args, &block)
134
133
  options = args.extract_options!
135
- RenderTemplateMatcher.new(options.merge(:layout => args.first)).spec(self)
134
+ RenderTemplateMatcher.new(options.merge(:layout => args.first), &block).spec(self)
136
135
  end
137
136
 
138
137
  # This is just a shortcut for render_template :layout => nil. It's also
139
138
  # used for Shoulda compatibility. Check render_template for more information.
140
139
  #
141
- def render_without_layout(options={})
142
- RenderTemplateMatcher.new(options.merge(:layout => nil)).spec(self)
140
+ def render_without_layout(options={}, &block)
141
+ RenderTemplateMatcher.new(options.merge(:layout => nil), &block).spec(self)
143
142
  end
144
143
 
145
144
  end
@@ -2,7 +2,6 @@ module Remarkable
2
2
  module ActionController
3
3
  module Matchers
4
4
  class RespondWithMatcher < Remarkable::ActionController::Base #:nodoc:
5
-
6
5
  arguments
7
6
 
8
7
  optional :with, :body, :content_type
@@ -98,26 +97,26 @@ module Remarkable
98
97
  # it { should respond_with(301).content_type(Mime::XML) }
99
98
  # it { should respond_with(300..399).content_type(Mime::XML) }
100
99
  #
101
- def respond_with(*args)
100
+ def respond_with(*args, &block)
102
101
  options = args.extract_options!
103
- RespondWithMatcher.new(options.merge(:with => args.first)).spec(self)
102
+ RespondWithMatcher.new(options.merge(:with => args.first), &block).spec(self)
104
103
  end
105
104
 
106
105
  # This is just a shortcut for respond_with :body => body. Check respond_with
107
106
  # for more information.
108
107
  #
109
- def respond_with_body(*args)
108
+ def respond_with_body(*args, &block)
110
109
  options = args.extract_options!
111
- RespondWithMatcher.new(options.merge(:body => args.first)).spec(self)
110
+ RespondWithMatcher.new(options.merge(:body => args.first), &block).spec(self)
112
111
  end
113
112
 
114
113
  # This is just a shortcut for respond_with :content_type => content_type.
115
114
  # It's also used for Shoulda compatibility. Check respond_with for more
116
115
  # information.
117
116
  #
118
- def respond_with_content_type(*args)
117
+ def respond_with_content_type(*args, &block)
119
118
  options = args.extract_options!
120
- RespondWithMatcher.new(options.merge(:content_type => args.first)).spec(self)
119
+ RespondWithMatcher.new(options.merge(:content_type => args.first), &block).spec(self)
121
120
  end
122
121
 
123
122
  end
@@ -85,8 +85,8 @@ module Remarkable
85
85
  # should_route :get, '/users/5/posts', :controller => :posts, :action => :index, :user_id => 5
86
86
  # should_route :post, '/users/5/posts', :controller => :posts, :action => :create, :user_id => 5
87
87
  #
88
- def route(*params)
89
- RouteMatcher.new(*params).spec(self)
88
+ def route(*params, &block)
89
+ RouteMatcher.new(*params, &block).spec(self)
90
90
  end
91
91
 
92
92
  end
@@ -2,9 +2,9 @@ module Remarkable
2
2
  module ActionController
3
3
  module Matchers
4
4
  class SetSessionMatcher < Remarkable::ActionController::Base #:nodoc:
5
- arguments :collection => :keys, :as => :key, :block => :block
5
+ arguments :collection => :keys, :as => :key, :block => true
6
6
 
7
- optional :to
7
+ optional :to, :block => true
8
8
 
9
9
  assertion :is_not_empty?, :contains_value?
10
10
  collection_assertions :assigned_value?, :is_equal_value?
@@ -86,7 +86,12 @@ describe 'assign_to' do
86
86
 
87
87
  should_assign_to :user
88
88
  should_assign_to :user, :with => 'jose'
89
- should_assign_to :user, :with_kind_of => String
89
+ should_assign_to :user, :with_kind_of => String
90
+
91
+ should_assign_to :user do |m|
92
+ m.with { 'jose' }
93
+ m.with_kind_of String
94
+ end
90
95
 
91
96
  should_not_assign_to :post
92
97
  should_not_assign_to :user, :with => 'joseph'
@@ -141,7 +141,12 @@ describe 'respond_with' do
141
141
  should_respond_with 200, :content_type => Mime::HTML
142
142
  should_respond_with :ok, :content_type => Mime::HTML
143
143
  should_respond_with :success, :content_type => Mime::HTML
144
- should_respond_with 200..299, :content_type => Mime::HTML
144
+ should_respond_with 200..299, :content_type => Mime::HTML
145
+
146
+ should_respond_with 200 do |m|
147
+ m.body /\s*/
148
+ m.content_type Mime::HTML
149
+ end
145
150
 
146
151
  should_not_respond_with 404
147
152
  should_not_respond_with :not_found
@@ -130,7 +130,10 @@ describe 'set_cookies' do
130
130
  should_not_set_cookies :user, :to => 'joseph'
131
131
 
132
132
  should_set_cookies(:user){ 'jose' }
133
- should_set_cookies :user, :to => proc{ 'jose' }
133
+ should_set_cookies :user, :to => proc{ 'jose' }
134
+ should_set_cookies :user do |m|
135
+ m.to { 'jose' }
136
+ end
134
137
 
135
138
  should_not_set_cookies :user, :to => nil
136
139
  should_not_set_cookies(:user){ 'joseph' }
@@ -115,7 +115,11 @@ describe 'set_session' do
115
115
  should_not_set_session :user, :to => 'joseph'
116
116
 
117
117
  should_set_session(:user){ 'jose' }
118
- should_set_session :user, :to => proc{ 'jose' }
118
+ should_set_session :user, :to => proc{ 'jose' }
119
+
120
+ should_set_session :user do |m|
121
+ m.to { 'jose' }
122
+ end
119
123
 
120
124
  should_not_set_session :user, :to => nil
121
125
  should_not_set_session(:user){ 'joseph' }
@@ -82,8 +82,8 @@ describe 'set_the_flash' do
82
82
  should_set_the_flash :to => /jose/
83
83
  should_set_the_flash :notice
84
84
  should_set_the_flash :notice, :to => 'jose'
85
- should_set_the_flash :notice, :to => /jose/
86
-
85
+ should_set_the_flash :notice, :to => /jose/
86
+
87
87
  should_not_set_the_flash :to => 'joseph'
88
88
  should_not_set_the_flash :to => /joseph/
89
89
  should_not_set_the_flash :error
@@ -93,7 +93,11 @@ describe 'set_the_flash' do
93
93
  should_set_the_flash(:notice){ 'jose' }
94
94
  should_set_the_flash(:notice){ /jose/ }
95
95
  should_set_the_flash :notice, :to => proc{ 'jose' }
96
- should_set_the_flash :notice, :to => proc{ /jose/ }
96
+ should_set_the_flash :notice, :to => proc{ /jose/ }
97
+
98
+ should_set_the_flash :notice do |m|
99
+ m.to = /jose/
100
+ end
97
101
 
98
102
  should_not_set_the_flash :notice, :to => nil
99
103
  should_not_set_the_flash(:notice){ 'joseph' }
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'ruby-debug'
3
3
 
4
4
  RAILS_ENV = 'test'
5
- RAILS_VERSION = ENV['RAILS_VERSION'] || '2.2.2'
5
+ RAILS_VERSION = ENV['RAILS_VERSION'] || '2.3.2'
6
6
  RSPEC_VERSION = ENV['RSPEC_VERSION'] || Spec::VERSION::STRING
7
7
 
8
8
  # Load Rails
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remarkable_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Brando
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-04-24 00:00:00 +02:00
13
+ date: 2009-04-25 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 3.0.8
34
+ version: 3.0.9
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: remarkable_activerecord
@@ -41,7 +41,7 @@ dependencies:
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 3.0.8
44
+ version: 3.0.9
45
45
  version:
46
46
  description: "Remarkable Rails: collection of matchers and macros with I18n for Rails"
47
47
  email: