Skip to content

Instantly share code, notes, and snippets.

@hosh

hosh/api_spec.rb Secret

Created June 16, 2010 18:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hosh/749ee589ccbd278c28b2 to your computer and use it in GitHub Desktop.
Save hosh/749ee589ccbd278c28b2 to your computer and use it in GitHub Desktop.
describe WebService::Application
before(:each) do
unless ActiveRecord::Base.connection.open_transactions > 0
ActiveRecord::Base.connection.begin_db_transaction
ActiveRecord::Base.connection.increment_open_transactions
end
end
after(:each) do
if ActiveRecord::Base.connection.open_transactions > 0
ActiveRecord::Base.connection.rollback_db_transaction
ActiveRecord::Base.connection.decrement_open_transactions
end
end
# ...
end
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'rspec/rails'
require 'remarkable/active_record'
require 'machinist/active_record'
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
Rspec.configure do |config|
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
# If you'd prefer not to run each of your examples within a transaction,
# uncomment the following line.
config.use_transactional_examples true
end
[
[0] #<Merchants::Store:0x7f2b03ac59d8> {
:id => 1,
:name => "Store #235",
:merchant_id => 6,
:created_at => Tue, 15 Jun 2010 21:38:58 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:38:58 UTC +00:00
},
[1] #<Merchants::Store:0x7f2b03ac5910> {
:id => 2,
:name => "Store #5192",
:merchant_id => 7,
:created_at => Tue, 15 Jun 2010 21:38:58 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:38:58 UTC +00:00
},
[2] #<Merchants::Store:0x7f2b03ac5410> {
:id => 3,
:name => "Store #905",
:merchant_id => 8,
:created_at => Tue, 15 Jun 2010 21:38:58 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:38:58 UTC +00:00
},
[3] #<Merchants::Store:0x7f2b03ac4f10> {
:id => 26,
:name => "Store #8151",
:merchant_id => 86,
:created_at => Tue, 15 Jun 2010 21:39:03 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:39:03 UTC +00:00
},
[4] #<Merchants::Store:0x7f2b03ac4998> {
:id => 27,
:name => "Store #3049",
:merchant_id => 87,
:created_at => Tue, 15 Jun 2010 21:39:03 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:39:03 UTC +00:00
},
[5] #<Merchants::Store:0x7f2b03ac4470> {
:id => 28,
:name => "Store #753",
:merchant_id => 88,
:created_at => Tue, 15 Jun 2010 21:39:03 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:39:03 UTC +00:00
}
]
[
[ 0] #<Merchants::Store:0x7f85e05469c0> {
:id => 1,
:name => "Store #235",
:merchant_id => 6,
:created_at => Tue, 15 Jun 2010 21:34:40 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:40 UTC +00:00
},
[ 1] #<Merchants::Store:0x7f85e0546920> {
:id => 2,
:name => "Store #5192",
:merchant_id => 7,
:created_at => Tue, 15 Jun 2010 21:34:40 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:40 UTC +00:00
},
[ 2] #<Merchants::Store:0x7f85e0546420> {
:id => 3,
:name => "Store #905",
:merchant_id => 8,
:created_at => Tue, 15 Jun 2010 21:34:40 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:40 UTC +00:00
},
[ 3] #<Merchants::Store:0x7f85e0545f20> {
:id => 4,
:name => "Store #7813",
:merchant_id => 47,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[ 4] #<Merchants::Store:0x7f85e0545a20> {
:id => 5,
:name => "Store #2895",
:merchant_id => 48,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[ 5] #<Merchants::Store:0x7f85e0545520> {
:id => 6,
:name => "Store #5056",
:merchant_id => 49,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[ 6] #<Merchants::Store:0x7f85e0545020> {
:id => 7,
:name => "Store #144",
:merchant_id => 54,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[ 7] #<Merchants::Store:0x7f85e0544b20> {
:id => 8,
:name => "Store #4225",
:merchant_id => 55,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[ 8] #<Merchants::Store:0x7f85e0544620> {
:id => 9,
:name => "Store #7751",
:merchant_id => 56,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[ 9] #<Merchants::Store:0x7f85e0544120> {
:id => 10,
:name => "Store #3462",
:merchant_id => 59,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[10] #<Merchants::Store:0x7f85e0543c20> {
:id => 11,
:name => "Store #9394",
:merchant_id => 61,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[11] #<Merchants::Store:0x7f85e0543720> {
:id => 12,
:name => "Store #5396",
:merchant_id => 63,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[12] #<Merchants::Store:0x7f85e0543220> {
:id => 13,
:name => "Store #5374",
:merchant_id => 64,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[13] #<Merchants::Store:0x7f85e0542d20> {
:id => 14,
:name => "New Store",
:merchant_id => 66,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[14] #<Merchants::Store:0x7f85e0542820> {
:id => 15,
:name => "New Store",
:merchant_id => 67,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[15] #<Merchants::Store:0x7f85e0542320> {
:id => 16,
:name => "New Store",
:merchant_id => 68,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[16] #<Merchants::Store:0x7f85e0541e20> {
:id => 17,
:name => "New Store",
:merchant_id => 69,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[17] #<Merchants::Store:0x7f85e0541920> {
:id => 18,
:name => "Store #2962",
:merchant_id => 71,
:created_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:44 UTC +00:00
},
[18] #<Merchants::Store:0x7f85e0541420> {
:id => 19,
:name => "Store #2516",
:merchant_id => 73,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[19] #<Merchants::Store:0x7f85e0540f20> {
:id => 20,
:name => "Store #8444",
:merchant_id => 75,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[20] #<Merchants::Store:0x7f85e0540a20> {
:id => 21,
:name => "Store #3562",
:merchant_id => 77,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[21] #<Merchants::Store:0x7f85e0540520> {
:id => 22,
:name => "Store #4764",
:merchant_id => 79,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[22] #<Merchants::Store:0x7f85e0540020> {
:id => 23,
:name => "Store #8093",
:merchant_id => 81,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[23] #<Merchants::Store:0x7f85e053fb20> {
:id => 24,
:name => "Store #6542",
:merchant_id => 83,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[24] #<Merchants::Store:0x7f85e053f620> {
:id => 25,
:name => "Store #562",
:merchant_id => 85,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[25] #<Merchants::Store:0x7f85e053f120> {
:id => 26,
:name => "Store #8151",
:merchant_id => 86,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[26] #<Merchants::Store:0x7f85e053ec20> {
:id => 27,
:name => "Store #3049",
:merchant_id => 87,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
},
[27] #<Merchants::Store:0x7f85e053e720> {
:id => 28,
:name => "Store #753",
:merchant_id => 88,
:created_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00,
:updated_at => Tue, 15 Jun 2010 21:34:45 UTC +00:00
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment