Skip to content

Commit e2ae4a2

Browse files
committed
Cosmetic: Whitespace
1 parent 226f5b8 commit e2ae4a2

27 files changed

+148
-151
lines changed

CONTRIBUTION_GUIDELINES.rdoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
We're using GitHub[http://github.com/thoughtbot/shoulda/tree/master], and we've been getting any combination of github pull requests, tickets, patches, emails, etc. We need to normalize this workflow to make sure we don't miss any fixes.
1+
We're using GitHub[http://github.com/thoughtbot/shoulda/tree/master], and we've been getting any combination of github pull requests, tickets, patches, emails, etc. We need to normalize this workflow to make sure we don't miss any fixes.
22

33
* Make sure you're accessing the source from the {official repository}[http://github.com/thoughtbot/shoulda/tree/master].
44
* We prefer git branches over patches, but we can take either.
5-
* If you're using git, please make a branch for each separate contribution. We can cherry pick your commits, but pulling from a branch is easier.
5+
* If you're using git, please make a branch for each separate contribution. We can cherry pick your commits, but pulling from a branch is easier.
66
* If you're submitting patches, please cut each fix or feature into a separate patch.
7-
* There should be an issue[http://github.com/thoughtbot/shoulda/issues] for any submission. If you've found a bug and want to fix it, open a new ticket at the same time.
8-
* Please <b>don't send pull requests</b> Just update the issue with the url for your fix (or attach the patch) when it's ready. The github pull requests pretty much get dropped on the floor until someone with commit rights notices them in the mailbox.
9-
* Contributions without tests won't be accepted. The file <tt>/test/README</tt> explains the testing system pretty thoroughly.
7+
* There should be an issue[http://github.com/thoughtbot/shoulda/issues] for any submission. If you've found a bug and want to fix it, open a new ticket at the same time.
8+
* Please <b>don't send pull requests</b> Just update the issue with the url for your fix (or attach the patch) when it's ready. The github pull requests pretty much get dropped on the floor until someone with commit rights notices them in the mailbox.
9+
* Contributions without tests won't be accepted. The file <tt>/test/README</tt> explains the testing system pretty thoroughly.
1010

lib/shoulda/action_controller/matchers.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ module ActionController # :nodoc:
1414

1515
# By using the macro helpers you can quickly and easily create concise and
1616
# easy to read test suites.
17-
#
17+
#
1818
# This code segment:
19-
#
19+
#
2020
# describe UsersController, "on GET to show with a valid id" do
2121
# before(:each) do
2222
# get :show, :id => User.first.to_param
2323
# end
24-
#
24+
#
2525
# it { should assign_to(:user) }
2626
# it { should respond_with(:success) }
2727
# it { should render_template(:show) }
2828
# it { should not_set_the_flash) }
29-
#
29+
#
3030
# it "should do something else really cool" do
3131
# assigns[:user].id.should == 1
3232
# end
3333
# end
34-
#
34+
#
3535
# Would produce 5 tests for the show action
3636
module Matchers
3737
end

lib/shoulda/action_controller/matchers/assign_to_matcher.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def assigned_value?
6363
"Expected action to assign a value for @#{@variable}"
6464
false
6565
else
66-
@negative_failure_message =
66+
@negative_failure_message =
6767
"Didn't expect action to assign a value for @#{@variable}, " <<
6868
"but it was assigned to #{assigned_value.inspect}"
6969
true

lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def initialize(content_type)
3434
def description
3535
"respond with content type of #{@content_type}"
3636
end
37-
37+
3838
def matches?(controller)
3939
@controller = controller
4040
if @content_type.is_a?(Regexp)
@@ -43,32 +43,32 @@ def matches?(controller)
4343
response_content_type == @content_type
4444
end
4545
end
46-
46+
4747
def failure_message
4848
"Expected #{expectation}"
4949
end
50-
50+
5151
def negative_failure_message
5252
"Did not expect #{expectation}"
5353
end
54-
54+
5555
protected
56-
56+
5757
def response_content_type
5858
@controller.response.content_type.to_s
5959
end
60-
60+
6161
def lookup_by_extension(extension)
6262
Mime::Type.lookup_by_extension(extension.to_s).to_s
6363
end
64-
64+
6565
def expectation
6666
"content type to be #{@content_type}, " <<
6767
"but was #{response_content_type}"
6868
end
69-
69+
7070
end
71-
71+
7272
end
7373
end
7474
end

lib/shoulda/action_controller/matchers/respond_with_matcher.rb

+12-12
Original file line numberDiff line numberDiff line change
@@ -24,46 +24,46 @@ class RespondWithMatcher # :nodoc:
2424
def initialize(status)
2525
@status = symbol_to_status_code(status)
2626
end
27-
27+
2828
def matches?(controller)
2929
@controller = controller
3030
correct_status_code? || correct_status_code_range?
3131
end
32-
32+
3333
def failure_message
3434
"Expected #{expectation}"
3535
end
36-
36+
3737
def negative_failure_message
3838
"Did not expect #{expectation}"
3939
end
4040

4141
def description
4242
"respond with #{@status}"
4343
end
44-
44+
4545
protected
46-
46+
4747
def correct_status_code?
4848
response_code == @status
4949
end
50-
50+
5151
def correct_status_code_range?
5252
@status.is_a?(Range) &&
5353
@status.include?(response_code)
5454
end
55-
55+
5656
def response_code
5757
@controller.response.response_code
5858
end
59-
59+
6060
def symbol_to_status_code(potential_symbol)
6161
case potential_symbol
6262
when :success then 200
6363
when :redirect then 300..399
6464
when :missing then 404
6565
when :error then 500..599
66-
when Symbol
66+
when Symbol
6767
if defined?(::Rack::Utils::SYMBOL_TO_STATUS_CODE)
6868
::Rack::Utils::SYMBOL_TO_STATUS_CODE[potential_symbol]
6969
else
@@ -73,13 +73,13 @@ def symbol_to_status_code(potential_symbol)
7373
potential_symbol
7474
end
7575
end
76-
76+
7777
def expectation
7878
"response to be a #{@status}, but was #{response_code}"
7979
end
80-
80+
8181
end
82-
82+
8383
end
8484
end
8585
end

lib/shoulda/action_controller/matchers/route_matcher.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def stringify_params!
7171

7272
def route_recognized?
7373
begin
74-
@context.send(:assert_routing,
74+
@context.send(:assert_routing,
7575
{ :method => @method, :path => @path },
7676
@params)
7777

lib/shoulda/active_record/helpers.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module Shoulda # :nodoc:
22
module ActiveRecord # :nodoc:
33
module Helpers
44
def pretty_error_messages(obj) # :nodoc:
5-
obj.errors.map do |a, m|
6-
msg = "#{a} #{m}"
5+
obj.errors.map do |a, m|
6+
msg = "#{a} #{m}"
77
msg << " (#{obj.send(a).inspect})" unless a.to_sym == :base
88
end
99
end

lib/shoulda/active_record/macros.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def should_have_instance_methods(*methods)
377377
#
378378
# Ensure that the given columns are defined on the models backing SQL table.
379379
# Also aliased to should_have_db_column for readability.
380-
# Takes the same options available in migrations:
380+
# Takes the same options available in migrations:
381381
# :type, :precision, :limit, :default, :null, and :scale
382382
#
383383
# Examples:
@@ -390,7 +390,7 @@ def should_have_instance_methods(*methods)
390390
#
391391
def should_have_db_columns(*columns)
392392
::ActiveSupport::Deprecation.warn("use: should have_db_column")
393-
column_type, precision, limit, default, null, scale, sql_type =
393+
column_type, precision, limit, default, null, scale, sql_type =
394394
get_options!(columns, :type, :precision, :limit,
395395
:default, :null, :scale, :sql_type)
396396
columns.each do |name|

lib/shoulda/active_record/matchers/association_matcher.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def dependent(dependent)
7070

7171
def matches?(subject)
7272
@subject = subject
73-
association_exists? &&
74-
macro_correct? &&
75-
foreign_key_exists? &&
76-
through_association_valid? &&
73+
association_exists? &&
74+
macro_correct? &&
75+
foreign_key_exists? &&
76+
through_association_valid? &&
7777
dependent_correct? &&
7878
join_table_exists?
7979
end
@@ -160,7 +160,7 @@ def dependent_correct?
160160
end
161161

162162
def join_table_exists?
163-
if @macro != :has_and_belongs_to_many ||
163+
if @macro != :has_and_belongs_to_many ||
164164
::ActiveRecord::Base.connection.tables.include?(join_table.to_s)
165165
true
166166
else

lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def matches?(subject)
5757
@low_message ||= :inclusion
5858
@high_message ||= :inclusion
5959

60-
disallows_lower_value &&
60+
disallows_lower_value &&
6161
allows_minimum_value &&
6262
disallows_higher_value &&
6363
allows_maximum_value

lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def description
8484
def matches?(subject)
8585
super(subject)
8686
translate_messages!
87-
disallows_lower_length &&
87+
disallows_lower_length &&
8888
allows_minimum_length &&
8989
((@minimum == @maximum) ||
9090
(disallows_higher_length &&
@@ -106,7 +106,7 @@ def translate_messages!
106106
end
107107

108108
def disallows_lower_length
109-
@minimum == 0 ||
109+
@minimum == 0 ||
110110
@minimum.nil? ||
111111
disallows_length_of(@minimum - 1, @short_message)
112112
end

lib/shoulda/active_record/matchers/have_db_column_matcher.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def initialize(macro, column)
2424
@macro = macro
2525
@column = column
2626
end
27-
27+
2828
def of_type(column_type)
2929
@column_type = column_type
3030
self
3131
end
32-
32+
3333
def with_options(opts = {})
3434
@precision = opts[:precision]
3535
@limit = opts[:limit]
@@ -41,8 +41,8 @@ def with_options(opts = {})
4141

4242
def matches?(subject)
4343
@subject = subject
44-
column_exists? &&
45-
correct_column_type? &&
44+
column_exists? &&
45+
correct_column_type? &&
4646
correct_precision? &&
4747
correct_limit? &&
4848
correct_default? &&
@@ -80,7 +80,7 @@ def column_exists?
8080
false
8181
end
8282
end
83-
83+
8484
def correct_column_type?
8585
return true if @column_type.nil?
8686
if matched_column.type.to_s == @column_type.to_s
@@ -91,7 +91,7 @@ def correct_column_type?
9191
false
9292
end
9393
end
94-
94+
9595
def correct_precision?
9696
return true if @precision.nil?
9797
if matched_column.precision.to_s == @precision.to_s
@@ -103,7 +103,7 @@ def correct_precision?
103103
false
104104
end
105105
end
106-
106+
107107
def correct_limit?
108108
return true if @limit.nil?
109109
if matched_column.limit.to_s == @limit.to_s
@@ -115,7 +115,7 @@ def correct_limit?
115115
false
116116
end
117117
end
118-
118+
119119
def correct_default?
120120
return true if @default.nil?
121121
if matched_column.default.to_s == @default.to_s
@@ -127,7 +127,7 @@ def correct_default?
127127
false
128128
end
129129
end
130-
130+
131131
def correct_null?
132132
return true if @null.nil?
133133
if matched_column.null.to_s == @null.to_s
@@ -139,7 +139,7 @@ def correct_null?
139139
false
140140
end
141141
end
142-
142+
143143
def correct_scale?
144144
return true if @scale.nil?
145145
if matched_column.scale.to_s == @scale.to_s
@@ -150,7 +150,7 @@ def correct_scale?
150150
false
151151
end
152152
end
153-
153+
154154
def matched_column
155155
model_class.columns.detect { |each| each.name == @column.to_s }
156156
end

0 commit comments

Comments
 (0)