diff --git a/History.txt b/History.txt index 51e02fcb..b1459b0b 100644 --- a/History.txt +++ b/History.txt @@ -1,13 +1,17 @@ == 0.2.9 - 27 Apr 2010 -* 1 minor improvement +* 3 minor improvements * Fixed problem with verifying model attribute using strings with escaped quotes [Michael MacDonald] + * Added handling for positive and negative floats [Michael MacDonald, #railscamp7] + * Added handling of ruby integer syntax (e.g. 1_000_000) [Ian White] + == 0.2.8 - 5 Apr 2010 * 1 minor improvement * 'Then show me the email' works as expected now [#18] + == 0.2.7 - 5 Apr 2010 * 1 minor improvement diff --git a/features/pickle/create_from_active_record.feature b/features/pickle/create_from_active_record.feature index 68506409..1c3f9f0c 100644 --- a/features/pickle/create_from_active_record.feature +++ b/features/pickle/create_from_active_record.feature @@ -24,11 +24,13 @@ Feature: I can easily create models from my blueprints Scenario: I create positive and negative users Given a user exists with name: "Fred", attitude_score: +5.42 And another user exists with name: "Ethel", attitude_score: -10 - Then 2 users should exist + And another user exists with name: "Buddha", attitude_score: 2_000_000 + Then 3 users should exist And the 1st user should be a positive person And the 2nd user should not be a positive person And the 1st user's attitude_score should be 5.42 And the 2nd user's attitude_score should be -10 + And the 3rd user's attitude_score should be 2_000_000 Scenario: I create nil values Given a user exists with name: "Fred", attitude_score: nil diff --git a/lib/pickle/parser/matchers.rb b/lib/pickle/parser/matchers.rb index e75860de..4cc3d048 100644 --- a/lib/pickle/parser/matchers.rb +++ b/lib/pickle/parser/matchers.rb @@ -22,7 +22,7 @@ def match_label end def match_value - "(?:\"#{match_quoted}\"|nil|true|false|[+-]?\\d+(?:\\.\\d+)?)" + "(?:\"#{match_quoted}\"|nil|true|false|[+-]?[0-9_]+(?:\\.\\d+)?)" end def match_field diff --git a/rails_generators/pickle/templates/pickle_steps.rb b/rails_generators/pickle/templates/pickle_steps.rb index 48d981e8..00b19476 100755 --- a/rails_generators/pickle/templates/pickle_steps.rb +++ b/rails_generators/pickle/templates/pickle_steps.rb @@ -79,7 +79,7 @@ case expected when 'nil', 'true', 'false' actual_value.send(expectation, send("be_#{expected}")) - when /^[+-]?\d+(\.\d+)?$/ + when /^[+-]?[0-9_]+(\.\d+)?$/ actual_value.send(expectation, eql(expected.to_f)) else actual_value.to_s.send(expectation, eql(eval(expected)))