Permalink
Browse files

Update tests to account for 1.8.7p357's indeterminate hash enumeratio…

…n order
  • Loading branch information...
1 parent 0cb6bbd commit 43c2969455fc7e3d766fcd94d64679f530c2a90e @dburkes dburkes committed Jan 17, 2012
Showing with 10 additions and 4 deletions.
  1. +1 −1 Rakefile
  2. +3 −2 spec/lib/client_spec.rb
  3. +6 −1 spec/lib/sobject/sobject_spec.rb
View
@@ -6,7 +6,7 @@ RSpec::Core::RakeTask.new(:spec)
desc "runs specs on all supported rubies"
task :spec_rubies do
- system "rvm ruby-1.9.2-p180@databasedotcom,ruby-1.8.7-p302@databasedotcom,ruby-1.9.3@databasedotcom,ree@databasedotcom --create do rake spec"
+ system "rvm ruby-1.9.2-p180@databasedotcom,ruby-1.8.7-p357@databasedotcom,ruby-1.9.3@databasedotcom,ree@databasedotcom --create do rake spec"
end
task :default => :spec
View
@@ -822,7 +822,8 @@ class Something;
it "applies type coercions before serializing" do
@client.create(MySobjects::Whizbang, "Date_Field" => Date.civil(2011, 1, 1), "DateTime_Field" => DateTime.civil(2011, 2, 1, 12), "Picklist_Multiselect_Field" => %w(a b))
- WebMock.should have_requested(:post, "https://na1.salesforce.com/services/data/v23.0/sobjects/Whizbang").with(:body => %|{"Date_Field":"2011-01-01","DateTime_Field":"2011-02-01T12:00:00.000+0000","Picklist_Multiselect_Field":"a;b"}|)
+ #############
+ WebMock.should have_requested(:post, "https://na1.salesforce.com/services/data/v23.0/sobjects/Whizbang").with(:body => {"Date_Field" => "2011-01-01", "DateTime_Field" => "2011-02-01T12:00:00.000+0000", "Picklist_Multiselect_Field" => "a;b"})
end
it "does not apply coercion to String value in a 'date' field" do
@@ -870,7 +871,7 @@ class Something;
it "applies type coercions before serializing" do
stub_request(:patch, "https://na1.salesforce.com/services/data/v23.0/sobjects/Whizbang/rid").to_return(:body => nil, :status => 204)
@client.update("Whizbang", "rid", "Date_Field" => Date.civil(2011, 1, 1), "DateTime_Field" => DateTime.civil(2011, 2, 1, 12), "Picklist_Multiselect_Field" => %w(a b))
- WebMock.should have_requested(:patch, "https://na1.salesforce.com/services/data/v23.0/sobjects/Whizbang/rid").with(:body => %|{"Date_Field":"2011-01-01","DateTime_Field":"2011-02-01T12:00:00.000+0000","Picklist_Multiselect_Field":"a;b"}|)
+ WebMock.should have_requested(:patch, "https://na1.salesforce.com/services/data/v23.0/sobjects/Whizbang/rid").with(:body => {"Date_Field" => "2011-01-01", "DateTime_Field" => "2011-02-01T12:00:00.000+0000", "Picklist_Multiselect_Field" => "a;b"})
end
end
end
@@ -463,7 +463,12 @@ class TestClass < Databasedotcom::Sobject::Sobject
context "with multiple attributes" do
it "searches for a record with the specified attributes and initializes it if it doesn't exist" do
- @client.should_receive(:query).with("SELECT #{@field_names.join(',')} FROM TestClass WHERE Name = 'Richard' AND Email_Field = 'fake@email.com' LIMIT 1").and_return(nil)
+ @client.should_receive(:query) do |select_statement|
+ select_statement.index("SELECT #{@field_names.join(',')} FROM TestClass WHERE").should be_zero
+ select_statement.index("Name = 'Richard'").should_not == -1
+ select_statement.index("Email_Field = 'fake@email.com'").should_not == -1
+ select_statement.index("LIMIT 1").should_not == -1
+ end
result = TestClass.find_or_initialize_by_Name_and_Email_Field('Richard', 'fake@email.com')
result.Name.should == "Richard"
result.Email_Field.should == "fake@email.com"

0 comments on commit 43c2969

Please sign in to comment.