carlosbrando-remarkable 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. data/Manifest.txt +0 -1
  2. data/lib/remarkable.rb +1 -1
  3. data/lib/remarkable/active_record/README.markdown +10 -10
  4. data/lib/remarkable/active_record/macros.rb +23 -13
  5. data/lib/remarkable/active_record/macros/callbacks/callback_matcher.rb +2 -0
  6. data/lib/remarkable/active_record/macros/database/have_db_column_matcher.rb +6 -11
  7. data/lib/remarkable/active_record/macros/database/index_matcher.rb +3 -1
  8. data/lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb +5 -2
  9. data/lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb +2 -0
  10. data/lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb +2 -0
  11. data/lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb +19 -4
  12. data/lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb +0 -9
  13. data/lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb +0 -16
  14. data/lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb +0 -10
  15. data/lib/remarkable/controller/controller.rb +9 -0
  16. data/lib/remarkable/controller/macros.rb +17 -9
  17. data/lib/remarkable/controller/macros/assign_matcher.rb +1 -7
  18. data/lib/remarkable/controller/macros/route_matcher.rb +15 -12
  19. data/lib/remarkable/controller/macros/set_session_matcher.rb +1 -5
  20. data/lib/remarkable/controller/macros/set_the_flash_matcher.rb +1 -9
  21. data/remarkable.gemspec +2 -2
  22. metadata +1 -2
  23. data/lib/remarkable/controller/macros/metadata_matcher.rb +0 -63
data/Manifest.txt CHANGED
@@ -37,7 +37,6 @@ lib/remarkable/controller/helpers.rb
37
37
  lib/remarkable/controller/macros.rb
38
38
  lib/remarkable/controller/macros/assign_matcher.rb
39
39
  lib/remarkable/controller/macros/filter_params_matcher.rb
40
- lib/remarkable/controller/macros/metadata_matcher.rb
41
40
  lib/remarkable/controller/macros/render_with_layout_matcher.rb
42
41
  lib/remarkable/controller/macros/respond_with_content_type_matcher.rb
43
42
  lib/remarkable/controller/macros/respond_with_matcher.rb
data/lib/remarkable.rb CHANGED
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Remarkable
5
- VERSION = '2.3.0'
5
+ VERSION = '2.3.1'
6
6
  end
7
7
 
8
8
  if ENV['RAILS_ENV'] == 'test' && defined?(Spec)
@@ -46,22 +46,22 @@ Options:
46
46
 
47
47
  h2. Database
48
48
 
49
- h3. have_db_column
49
+ h3. have_column
50
50
 
51
51
  Ensure that the given column is defined on the models backing SQL table. The options are the same as the instance variables defined on the column definition: :precision, :limit, :default, :null, :primary, :type, :scale, and :sql_type.
52
52
 
53
- <pre><code> should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
53
+ <pre><code> should_have_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
54
54
  :null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)'
55
55
 
56
- it { should have_db_column(:email, :type => "string", :default => nil, :precision => nil, :limit => 255,
56
+ it { should have_column(:email, :type => "string", :default => nil, :precision => nil, :limit => 255,
57
57
  :null => true, :primary => false, :scale => nil, :sql_type => 'varchar(255)') }</code></pre>
58
58
 
59
- h3. have_db_columns
59
+ h3. have_columns
60
60
 
61
61
  Ensure that the given columns are defined on the models backing SQL table.
62
62
 
63
- <pre><code> should_have_db_columns :id, :email, :name, :created_at
64
- it { should have_db_columns :id, :email, :name, :created_at }</code></pre>
63
+ <pre><code> should_have_columns :id, :email, :name, :created_at
64
+ it { should have_columns :id, :email, :name, :created_at }</code></pre>
65
65
 
66
66
  h3. have_indices
67
67
 
@@ -116,7 +116,7 @@ Ensures that the attribute can be set on mass update.
116
116
  should_allow_mass_assignment_of :email, :name
117
117
  it { should allow_mass_assignment_of(:email, :name) }
118
118
 
119
- h3. have_named_scope
119
+ h3. have_scope
120
120
 
121
121
  Ensures that the model has a method named scope_name that returns a NamedScope object with the proxy options set to the options you supply. scope_name can be either a symbol, or a method call which will be evaled against the model. The eval‘d method call has access to all the same instance variables that a should statement would.
122
122
 
@@ -124,7 +124,7 @@ Options: Any of the options that the named scope would pass on to find.
124
124
 
125
125
  Example:
126
126
 
127
- should_have_named_scope :visible, :conditions => {:visible => true}
127
+ should_have_scope :visible, :conditions => {:visible => true}
128
128
 
129
129
  Passes for:
130
130
 
@@ -138,8 +138,8 @@ Or for:
138
138
 
139
139
  You can test lambdas or methods that return ActiveRecord#scoped calls:
140
140
 
141
- should_have_named_scope 'recent(5)', :limit => 5
142
- should_have_named_scope 'recent(1)', :limit => 1
141
+ should_have_scope :recent, :with => 5, :limit => 5
142
+ should_have_scope :recent, :with => 1, :limit => 1
143
143
 
144
144
  Passes for:
145
145
 
@@ -5,11 +5,11 @@ module Remarkable # :nodoc:
5
5
 
6
6
  def method_missing_with_remarkable(method_id, *args, &block)
7
7
  if method_id.to_s =~ /^should_not_(.*)/
8
- should_not_method_missing($1, *args)
8
+ should_not_method_missing($1, caller, *args, &block)
9
9
  elsif method_id.to_s =~ /^should_(.*)/
10
- should_method_missing($1, *args)
10
+ should_method_missing($1, caller, *args, &block)
11
11
  elsif method_id.to_s =~ /^xshould_(not_)?(.*)/
12
- pending_method_missing($2, $1, *args)
12
+ pending_method_missing($2, $1, *args, &block)
13
13
  else
14
14
  method_missing_without_remarkable(method_id, *args, &block)
15
15
  end
@@ -18,22 +18,32 @@ module Remarkable # :nodoc:
18
18
 
19
19
  private
20
20
 
21
- def should_not_method_missing(method, *args)
22
- matcher = create_and_configure_matcher(method, *args)
21
+ def should_not_method_missing(method, caller, *args, &block)
22
+ matcher = create_and_configure_matcher(method, *args, &block)
23
23
  it "should not #{matcher.description}" do
24
- assert_rejects(matcher.negative.spec(self), subject_class)
24
+ begin
25
+ should_not matcher.negative.spec(self)
26
+ rescue Exception => e
27
+ e.set_backtrace(caller.to_a)
28
+ raise e
29
+ end
25
30
  end
26
31
  end
27
32
 
28
- def should_method_missing(method, *args)
29
- matcher = create_and_configure_matcher(method, *args)
33
+ def should_method_missing(method, caller, *args, &block)
34
+ matcher = create_and_configure_matcher(method, *args, &block)
30
35
  it "should #{matcher.description}" do
31
- assert_accepts(matcher.spec(self), subject_class)
36
+ begin
37
+ should matcher.spec(self)
38
+ rescue Exception => e
39
+ e.set_backtrace(caller.to_a)
40
+ raise e
41
+ end
32
42
  end
33
43
  end
34
44
 
35
- def pending_method_missing(method, negative, *args)
36
- matcher = create_and_configure_matcher(method, *args)
45
+ def pending_method_missing(method, negative, *args, &block)
46
+ matcher = create_and_configure_matcher(method, *args, &block)
37
47
  matcher.negative if negative
38
48
  description = matcher.description
39
49
  xit "should #{'not ' if negative}#{description}"
@@ -41,8 +51,8 @@ module Remarkable # :nodoc:
41
51
  xit "should #{'not ' if negative}#{method.to_s.gsub('_',' ')}"
42
52
  end
43
53
 
44
- def create_and_configure_matcher(method, *args)
45
- matcher = send(method, *args)
54
+ def create_and_configure_matcher(method, *args, &block)
55
+ matcher = send(method, *args, &block)
46
56
  matcher.table_name = self.described_type.table_name if matcher.respond_to?('table_name=')
47
57
  matcher
48
58
  end
@@ -4,6 +4,8 @@ module Remarkable # :nodoc:
4
4
 
5
5
  ::ActiveRecord::Callbacks::CALLBACKS.each do |callback|
6
6
  define_method("have_#{callback}_callback") do |method|
7
+ warn "[DEPRECATION] have_#{callback}_callback is deprecated and will be removed in the next Remarkable version. " <<
8
+ "For more information, please check: http://carlosbrando.lighthouseapp.com/projects/19775/milestones/35628-remarkable-231"
7
9
  CallbackMatcher.new(callback, method)
8
10
  end
9
11
  end
@@ -4,17 +4,10 @@ module Remarkable # :nodoc:
4
4
 
5
5
  class ColumnMatcher < Remarkable::Matcher::Base
6
6
  arguments :columns
7
-
7
+
8
8
  optional :type, :default, :precision, :limit, :scale, :sql_type
9
9
  optional :primary, :null, :default => true
10
10
 
11
- # TODO: remove it
12
- def of_type(type)
13
- warn "[DEPRECATION] option of_type is deprecated in have_db_column. Use type instead."
14
- @options[:type] = type
15
- self
16
- end
17
-
18
11
  # Method used to load all options via hash.
19
12
  # (:type, :default, :precision, :limit, :scale, :sql_type, :primary, :null)
20
13
  #
@@ -89,19 +82,21 @@ module Remarkable # :nodoc:
89
82
  # (:type => :string, :primary => true, etc.)
90
83
  #
91
84
  # Example:
92
- # it { should have_db_column(:name).type(:string) }
93
- # it { should have_db_column(:age).with_options(:type => :integer) }
94
- # it { should_not have_db_column(:salary) }
85
+ # it { should have_column(:name).type(:string) }
86
+ # it { should have_column(:age).with_options(:type => :integer) }
87
+ # it { should_not have_column(:salary) }
95
88
  #
96
89
  def have_db_column(column, options = {})
97
90
  ColumnMatcher.new(column, options)
98
91
  end
92
+ alias :have_column :have_db_column
99
93
 
100
94
  # Alias for #have_db_column
101
95
  #
102
96
  def have_db_columns(*columns)
103
97
  ColumnMatcher.new(*columns)
104
98
  end
99
+ alias :have_columns :have_db_columns
105
100
 
106
101
  end
107
102
  end
@@ -81,7 +81,9 @@ module Remarkable # :nodoc:
81
81
  def have_indices(*columns)
82
82
  IndexMatcher.new(*columns)
83
83
  end
84
- alias_method :have_index, :have_indices
84
+ alias :have_index :have_indices
85
+ alias :have_db_index :have_indices
86
+ alias :have_db_indices :have_indices
85
87
 
86
88
  end
87
89
  end
@@ -27,8 +27,11 @@ module Remarkable # :nodoc:
27
27
  protected = subject_class.protected_attributes || []
28
28
  accessible = subject_class.accessible_attributes || []
29
29
 
30
- return true if !protected.empty? && !protected.include?(attribute.to_s)
31
- return true if !accessible.empty? && accessible.include?(attribute.to_s)
30
+ if protected.empty?
31
+ return true if accessible.empty? || accessible.include?(attribute.to_s)
32
+ else
33
+ return true unless protected.include?(attribute.to_s)
34
+ end
32
35
 
33
36
  @missing = accessible.empty? ? "#{subject_class} is protecting #{protected.to_a.to_sentence}" :
34
37
  "#{subject_class} has not made #{attribute} accessible"
@@ -47,6 +47,8 @@ module Remarkable # :nodoc:
47
47
  # it { should have_class_methods(:find, :destroy) }
48
48
  #
49
49
  def have_class_methods(*methods)
50
+ warn "[DEPRECATION] have_class_methods is deprecated and will be removed in the next Remarkable version. " <<
51
+ "For more information, please check: http://carlosbrando.lighthouseapp.com/projects/19775/milestones/35628-remarkable-231"
50
52
  HaveClassMethods.new(*methods)
51
53
  end
52
54
  end
@@ -47,6 +47,8 @@ module Remarkable # :nodoc:
47
47
  # it { should have_instance_methods(:email, :name, :name=) }
48
48
  #
49
49
  def have_instance_methods(*methods)
50
+ warn "[DEPRECATION] have_instance_methods is deprecated and will be removed in the next Remarkable version. " <<
51
+ "For more information, please check: http://carlosbrando.lighthouseapp.com/projects/19775/milestones/35628-remarkable-231"
50
52
  HaveInstanceMethods.new(*methods)
51
53
  end
52
54
  end
@@ -2,17 +2,31 @@ module Remarkable # :nodoc:
2
2
  module ActiveRecord # :nodoc:
3
3
  module Matchers # :nodoc:
4
4
  class HaveNamedScope < Remarkable::Matcher::Base
5
+
5
6
  def initialize(scope_call, *args)
6
7
  @scope_opts = args.extract_options!
7
8
  @scope_call = scope_call.to_s
8
9
  @args = args
9
10
  end
10
11
 
12
+ def with(args)
13
+ @scope_call[:with] = args
14
+ self
15
+ end
16
+
11
17
  def matches?(subject)
12
18
  @subject = subject
13
19
 
14
20
  assert_matcher do
15
- @scope = eval("#{subject_class}.#{@scope_call}")
21
+ @scope = if @scope_call.to_s.match(/(\w+)\(([@\w]+)\)/)
22
+ warn "[DEPRECATION] Strings given to have_scope won't be evaluated anymore, " <<
23
+ "please give :with as option. have_scope(:#{$1}, :with => [#{$2}])"
24
+ @spec.instance_eval("#{subject_class}.#{@scope_call}")
25
+ elsif @scope_opts[:with]
26
+ subject_class.send(@scope_call, *@scope_opts.delete(:with))
27
+ else
28
+ subject_class.send(@scope_call)
29
+ end
16
30
  return_scope_object? && scope_itself_to_options?
17
31
  end
18
32
  end
@@ -60,7 +74,7 @@ module Remarkable # :nodoc:
60
74
  #
61
75
  # Example:
62
76
  #
63
- # it { should have_named_scope(:visible, :conditions => {:visible => true}) }
77
+ # it { should have_scope(:visible, :conditions => {:visible => true}) }
64
78
  #
65
79
  # Passes for
66
80
  #
@@ -74,8 +88,8 @@ module Remarkable # :nodoc:
74
88
  #
75
89
  # You can test lambdas or methods that return ActiveRecord#scoped calls:
76
90
  #
77
- # it { should have_named_scope('recent(5)', :limit => 5) }
78
- # it { should have_named_scope('recent(1)', :limit => 1) }
91
+ # should_have_scope :recent, :with => 5, :limit => 5
92
+ # should_have_scope :recent, :with => 1, :limit => 1
79
93
  #
80
94
  # Passes for
81
95
  # named_scope :recent, lambda {|c| {:limit => c}}
@@ -89,6 +103,7 @@ module Remarkable # :nodoc:
89
103
  def have_named_scope(scope_call, *args)
90
104
  HaveNamedScope.new(scope_call, *args)
91
105
  end
106
+ alias :have_scope :have_named_scope
92
107
  end
93
108
  end
94
109
  end
@@ -30,15 +30,6 @@ module Remarkable # :nodoc:
30
30
  def validate_exclusion_of(attribute, *good_values)
31
31
  options = good_values.extract_options!
32
32
 
33
- # TODO Remove this until the next comment
34
- unless options.key?(:in) || good_values.empty?
35
- warn "[DEPRECATION] Please use validate_exclusion_of(#{attribute.inspect}, :in => #{good_values.inspect}) " <<
36
- "instead of validate_exclusion_of(#{attribute.inspect}, #{good_values.inspect[1..-2]})."
37
- end
38
-
39
- options[:in] ||= good_values
40
-
41
- # From now on is what should be the actual method.
42
33
  good_values = [options.delete(:in)].flatten.compact
43
34
  good_values << options
44
35
 
@@ -30,15 +30,6 @@ module Remarkable # :nodoc:
30
30
  def validate_inclusion_of(attribute, *good_values)
31
31
  options = good_values.extract_options!
32
32
 
33
- # TODO Remove this until the next comment
34
- unless options.key?(:in) || good_values.empty?
35
- warn "[DEPRECATION] Please use validate_inclusion_of(#{attribute.inspect}, :in => #{good_values.inspect}) " <<
36
- "instead of validate_inclusion_of(#{attribute.inspect}, #{good_values.inspect[1..-2]})."
37
- end
38
-
39
- options[:in] ||= good_values
40
-
41
- # From now on is what should be the actual method.
42
33
  good_values = [options.delete(:in)].flatten.compact
43
34
  good_values << options
44
35
 
@@ -49,13 +40,6 @@ module Remarkable # :nodoc:
49
40
  end
50
41
  end
51
42
 
52
- # TODO This one is for shoulda compatibility. Deprecate it?
53
- def ensure_inclusion_of(attribute, *good_values) #:nodoc:
54
- warn "[DEPRECATION] should_ensure_inclusion_of is deprecated. " <<
55
- "Use should_validate_inclusion_of instead."
56
- validate_inclusion_of(attribute, *good_values)
57
- end
58
-
59
43
  end
60
44
  end
61
45
  end
@@ -10,16 +10,6 @@ module Remarkable # :nodoc:
10
10
  assertions :less_than_min_length?, :exactly_min_length?, :allow_nil?,
11
11
  :more_than_max_length?, :exactly_max_length?, :allow_blank?
12
12
 
13
- def short_message(message)
14
- warn "[DEPRECATION] :short_message is deprecated for validate_length_of, please use :too_short instead"
15
- too_short(message)
16
- end
17
-
18
- def long_message(message)
19
- warn "[DEPRECATION] :long_message is deprecated for validate_length_of, please use :too_long instead"
20
- too_long(message)
21
- end
22
-
23
13
  def within(range)
24
14
  @behavior = :within
25
15
  @options[:minimum] = range.first
@@ -15,6 +15,15 @@ module Spec
15
15
  private
16
16
  include Remarkable::Private
17
17
  end
18
+
19
+ class RoutingExampleGroup
20
+ include Remarkable::Assertions
21
+ include Remarkable::Controller::Matchers
22
+ extend Remarkable::Controller::Macros
23
+
24
+ private
25
+ include Remarkable::Private
26
+ end
18
27
  end
19
28
  end
20
29
  end
@@ -44,14 +44,14 @@ module Remarkable # :nodoc:
44
44
  end
45
45
 
46
46
  def should_not_set_the_flash
47
- should_method_missing :set_the_flash_to, nil
47
+ should_method_missing :set_the_flash, caller, nil
48
48
  end
49
49
 
50
50
  def method_missing_with_remarkable(method_id, *args, &block)
51
51
  if method_id.to_s =~ /^should_not_(.*)/
52
- should_not_method_missing($1, *args, &block)
52
+ should_not_method_missing($1, caller, *args, &block)
53
53
  elsif method_id.to_s =~ /^should_(.*)/
54
- should_method_missing($1, *args, &block)
54
+ should_method_missing($1, caller, *args, &block)
55
55
  elsif method_id.to_s =~ /^xshould_(not_)?(.*)/
56
56
  pending_method_missing($2, $1, *args, &block)
57
57
  else
@@ -62,19 +62,27 @@ module Remarkable # :nodoc:
62
62
 
63
63
  private
64
64
 
65
- def should_method_missing(method, *args, &block)
65
+ def should_method_missing(method, caller, *args, &block)
66
66
  matcher = send(method, *args, &block)
67
67
  it "should #{matcher.description}" do
68
- matcher.spec(self)
69
- assert_accepts(matcher, subject_class)
68
+ begin
69
+ should matcher.spec(self)
70
+ rescue Exception => e
71
+ e.set_backtrace(caller.to_a)
72
+ raise e
73
+ end
70
74
  end
71
75
  end
72
76
 
73
- def should_not_method_missing(method, *args, &block)
77
+ def should_not_method_missing(method, caller, *args, &block)
74
78
  matcher = send(method, *args, &block)
75
79
  it "should not #{matcher.description}" do
76
- matcher.spec(self).negative
77
- assert_rejects(matcher, subject_class)
80
+ begin
81
+ should_not matcher.negative.spec(self)
82
+ rescue Exception => e
83
+ e.set_backtrace(caller.to_a)
84
+ raise e
85
+ end
78
86
  end
79
87
  end
80
88
 
@@ -9,13 +9,7 @@ module Remarkable # :nodoc:
9
9
  def initialize(*names, &block)
10
10
  @options = names.extract_options!
11
11
  @names = names
12
- @options[:equals] = block if block_given?
13
-
14
- warn "[DEPRECATION] :equals option is deprecated in should_assign_to. Please give :with instead." if @options[:equals]
15
- warn "[DEPRECATION] :class option is deprecated in should_assign_to. Please give :with_kind_of instead." if @options[:class]
16
-
17
- @options[:with] ||= @options.delete(:equals)
18
- @options[:with_kind_of] ||= @options.delete(:class)
12
+ @options[:with] ||= block if block_given?
19
13
  end
20
14
 
21
15
  def matches?(subject)
@@ -11,13 +11,10 @@ module Remarkable # :nodoc:
11
11
  def matches?(subject)
12
12
  @subject = subject
13
13
 
14
- initialize_with_spec!
14
+ @options[:controller] ||= controller_name
15
15
 
16
- unless @options[:controller]
17
- @options[:controller] = @controller.class.name.gsub(/Controller$/, '').tableize
18
- end
19
16
  @options[:controller] = @options[:controller].to_s
20
- @options[:action] = @options[:action].to_s
17
+ @options[:action] = @options[:action].to_s
21
18
 
22
19
  @populated_path = @path.dup
23
20
  @options.each do |key, value|
@@ -38,12 +35,18 @@ module Remarkable # :nodoc:
38
35
 
39
36
  private
40
37
 
41
- def initialize_with_spec!
42
- # In Rspec 1.1.12 we can actually do:
43
- #
44
- # @controller = @subject
45
- #
46
- @controller = @spec.instance_eval { controller }
38
+ def controller_name
39
+ controller = if @spec.class.respond_to?(:controller_class)
40
+ @spec.class.controller_class
41
+ elsif @spec.class.respond_to?(:described_class)
42
+ @spec.class.described_class
43
+ end
44
+
45
+ if controller.ancestors.include?(ActionController::Base)
46
+ controller.name.gsub(/Controller$/, '').tableize
47
+ else
48
+ raise ArgumentError, "I cannot guess the controller name in route_for. Please supply :controller as option"
49
+ end
47
50
  end
48
51
 
49
52
  def map_to_path?
@@ -68,7 +71,7 @@ module Remarkable # :nodoc:
68
71
  end
69
72
 
70
73
  def route(method, path, options)
71
- Route.new(method, path, options)
74
+ Route.new(method, path, options).spec(self)
72
75
  end
73
76
  end
74
77
  end
@@ -63,12 +63,8 @@ module Remarkable # :nodoc:
63
63
  def set_session(key, expected=nil, &block)
64
64
  expected = if expected.is_a?(Hash)
65
65
  expected[:to]
66
- elsif expected
67
- warn "[DEPRECATION] set_session(#{key.inspect}, #{expected.inspect}) is deprecated. " <<
68
- "Please use set_session(#{key.inspect}, :to => #{expected.inspect})"
69
- expected
70
66
  else
71
- expected
67
+ nil
72
68
  end
73
69
 
74
70
  SetSessionMatcher.new(key, expected, &block)
@@ -7,11 +7,8 @@ module Remarkable # :nodoc:
7
7
  def initialize(val)
8
8
  @val = if val.is_a?(Hash)
9
9
  val[:to]
10
- elsif val
11
- warn "[DEPRECATION] set_the_flash(#{val.inspect}) is deprecated, please use set_the_flash(:to => #{val.inspect}) instead"
12
- val
13
10
  else
14
- val
11
+ nil
15
12
  end
16
13
  end
17
14
 
@@ -66,11 +63,6 @@ module Remarkable # :nodoc:
66
63
  def set_the_flash(val={:to=>''})
67
64
  SetTheFlash.new(val)
68
65
  end
69
-
70
- def set_the_flash_to(val={:to=>''})
71
- warn "[DEPRECATION] set_the_flash_to matcher is deprecated, please use set_the_flash instead"
72
- SetTheFlash.new(val)
73
- end
74
66
  end
75
67
  end
76
68
  end
data/remarkable.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{remarkable}
5
- s.version = "2.3.0"
5
+ s.version = "2.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Carlos Brando", "Jos\303\251 Valim", "Diego Carrion"]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{}
11
11
  s.email = ["eduardobrando@gmail.com", "jose.valim@gmail.com", "dc.rec1@gmail.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
13
- s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "init.rb", "lib/remarkable.rb", "lib/remarkable/active_record/README.markdown", "lib/remarkable/active_record/active_record.rb", "lib/remarkable/active_record/helpers.rb", "lib/remarkable/active_record/macros.rb", "lib/remarkable/active_record/macros/associations/association_matcher.rb", "lib/remarkable/active_record/macros/callbacks/callback_matcher.rb", "lib/remarkable/active_record/macros/database/have_db_column_matcher.rb", "lib/remarkable/active_record/macros/database/index_matcher.rb", "lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb", "lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb", "lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb", "lib/remarkable/assertions.rb", "lib/remarkable/controller/README.markdown", "lib/remarkable/controller/controller.rb", "lib/remarkable/controller/helpers.rb", "lib/remarkable/controller/macros.rb", "lib/remarkable/controller/macros/assign_matcher.rb", "lib/remarkable/controller/macros/filter_params_matcher.rb", "lib/remarkable/controller/macros/metadata_matcher.rb", "lib/remarkable/controller/macros/render_with_layout_matcher.rb", "lib/remarkable/controller/macros/respond_with_content_type_matcher.rb", "lib/remarkable/controller/macros/respond_with_matcher.rb", "lib/remarkable/controller/macros/set_session_matcher.rb", "lib/remarkable/controller/macros/route_matcher.rb", "lib/remarkable/controller/macros/set_the_flash_matcher.rb", "lib/remarkable/dsl.rb", "lib/remarkable/example/example_methods.rb", "lib/remarkable/helpers.rb", "lib/remarkable/inflections.rb", "lib/remarkable/matcher_base.rb", "lib/remarkable/private_helpers.rb", "lib/remarkable/rails.rb", "lib/remarkable/rails/extract_options.rb", "rails/init.rb", "remarkable.gemspec", "script/console", "script/destroy", "script/generate"]
13
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "init.rb", "lib/remarkable.rb", "lib/remarkable/active_record/README.markdown", "lib/remarkable/active_record/active_record.rb", "lib/remarkable/active_record/helpers.rb", "lib/remarkable/active_record/macros.rb", "lib/remarkable/active_record/macros/associations/association_matcher.rb", "lib/remarkable/active_record/macros/callbacks/callback_matcher.rb", "lib/remarkable/active_record/macros/database/have_db_column_matcher.rb", "lib/remarkable/active_record/macros/database/index_matcher.rb", "lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb", "lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb", "lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb", "lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb", "lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb", "lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb", "lib/remarkable/assertions.rb", "lib/remarkable/controller/README.markdown", "lib/remarkable/controller/controller.rb", "lib/remarkable/controller/helpers.rb", "lib/remarkable/controller/macros.rb", "lib/remarkable/controller/macros/assign_matcher.rb", "lib/remarkable/controller/macros/filter_params_matcher.rb", "lib/remarkable/controller/macros/render_with_layout_matcher.rb", "lib/remarkable/controller/macros/respond_with_content_type_matcher.rb", "lib/remarkable/controller/macros/respond_with_matcher.rb", "lib/remarkable/controller/macros/set_session_matcher.rb", "lib/remarkable/controller/macros/route_matcher.rb", "lib/remarkable/controller/macros/set_the_flash_matcher.rb", "lib/remarkable/dsl.rb", "lib/remarkable/example/example_methods.rb", "lib/remarkable/helpers.rb", "lib/remarkable/inflections.rb", "lib/remarkable/matcher_base.rb", "lib/remarkable/private_helpers.rb", "lib/remarkable/rails.rb", "lib/remarkable/rails/extract_options.rb", "rails/init.rb", "remarkable.gemspec", "script/console", "script/destroy", "script/generate"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://www.nomedojogo.com/2008/11/18/shoulda-for-rspec-is-remarkable/}
16
16
  s.post_install_message = %q{PostInstall.txt}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carlosbrando-remarkable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Brando
@@ -108,7 +108,6 @@ files:
108
108
  - lib/remarkable/controller/macros.rb
109
109
  - lib/remarkable/controller/macros/assign_matcher.rb
110
110
  - lib/remarkable/controller/macros/filter_params_matcher.rb
111
- - lib/remarkable/controller/macros/metadata_matcher.rb
112
111
  - lib/remarkable/controller/macros/render_with_layout_matcher.rb
113
112
  - lib/remarkable/controller/macros/respond_with_content_type_matcher.rb
114
113
  - lib/remarkable/controller/macros/respond_with_matcher.rb
@@ -1,63 +0,0 @@
1
- # module Remarkable # :nodoc:
2
- # module Controller # :nodoc:
3
- # module Matchers # :nodoc:
4
- # class MetadataMatcher < Remarkable::Matcher::Base
5
- # include Remarkable::Controller::Helpers
6
- # include Test::Unit::Assertions
7
- # include ActionController::Assertions::SelectorAssertions
8
- #
9
- # def initialize(options)
10
- # @options = options
11
- # end
12
- #
13
- # def matches?(subject)
14
- # @subject = subject
15
- #
16
- # assert_matcher_for(@options) do |option|
17
- # @key, @value = option
18
- # body_is_blank? && has_metatag?
19
- # end
20
- # end
21
- #
22
- # def description
23
- # "have metatag #{@options.inspect}"
24
- # end
25
- #
26
- # private
27
- #
28
- # def body_is_blank?
29
- # return true unless @response.body.strip.empty?
30
- #
31
- # @missing = "response.body is empty, integrate_views was included in your spec?"
32
- # false
33
- # end
34
- #
35
- # def has_metatag?
36
- # begin
37
- # if @key.to_sym == :title
38
- # return true if assert_select("title", @value)
39
- # else
40
- # return true if assert_select("meta[name=?][content#{"*" if @value.is_a?(Regexp)}=?]", @key, @value)
41
- # end
42
- # rescue
43
- # @missing = "Expected metatag #{@key} matching \"#{@value}\", not found."
44
- # return false
45
- # end
46
- # end
47
- #
48
- # def html_document
49
- # xml = @response.content_type =~ /xml$/
50
- # @html_document ||= HTML::Document.new(@response.body, false, xml)
51
- # end
52
- #
53
- # def expectation
54
- # "have metatag #{@key}"
55
- # end
56
- # end
57
- #
58
- # def render_page_with_metadata(options)
59
- # MetadataMatcher.new(options)
60
- # end
61
- # end
62
- # end
63
- # end