-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Neeraj Singh
committed
Jan 27, 2012
0 parents
commit f51989e
Showing
25 changed files
with
300 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.bundle | ||
db/*.sqlite3 | ||
log/*.log | ||
tmp/ | ||
.sass-cache/ | ||
vendor/ruby | ||
config/database.yml | ||
guides/output | ||
public/assets | ||
public/uploads | ||
.DS_Store | ||
.tddium* | ||
.tddium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use ruby-1.9.2-p180@nimbleshop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FactoryGirl.define do | ||
factory :country_shipping_zone do |f| | ||
name "USA" | ||
code "US" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FactoryGirl.define do | ||
factory :creditcard do |f| | ||
cvv '123' | ||
number '4007000000027' | ||
cardtype 'visa' | ||
first_name 'Johnny' | ||
last_name 'Walker' | ||
address1 '100 Main street' | ||
state 'Florida' | ||
zipcode '33333' | ||
expires_on { 1.year.from_now } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FactoryGirl.define do | ||
factory :custom_field_answer do | ||
custom_field | ||
product | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FactoryGirl.define do | ||
factory :custom_field do | ||
sequence(:name) { |t| "name#{t}" } | ||
|
||
trait :number do | ||
field_type 'number' | ||
end | ||
|
||
trait :date do | ||
field_type 'date' | ||
end | ||
|
||
trait :text do | ||
field_type 'text' | ||
end | ||
|
||
factory :number_custom_field, traits: [:number] | ||
factory :date_custom_field, traits: [:date ] | ||
factory :text_custom_field, traits: [:text] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FactoryGirl.define do | ||
factory :line_item do |f| | ||
order | ||
product | ||
quantity 1 | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryGirl.define do | ||
factory :link_group do | ||
sequence(:name) { |t| "name#{t}" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FactoryGirl.define do | ||
factory :order do |f| | ||
sequence(:number) { |t| "xxx#{t}" } | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryGirl.define do | ||
factory :payment_method do |f| | ||
name 'Cash' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FactoryGirl.define do | ||
factory :picture do |f| | ||
product | ||
file_name nil | ||
content_type nil | ||
file_size nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FactoryGirl.define do | ||
factory :product_group_condition do | ||
|
||
trait :price_condition do | ||
name :price | ||
operator 'lt' | ||
value 43 | ||
end | ||
|
||
trait :name_condition do | ||
name :name | ||
operator 'starts' | ||
value 'george' | ||
end | ||
|
||
trait :text_condition do | ||
name { Factory.create(:text_custom_field).id } | ||
operator 'starts' | ||
value 'george' | ||
end | ||
|
||
trait :number_condition do | ||
name { Factory.create(:number_custom_field).id } | ||
operator 'lt' | ||
value 43 | ||
end | ||
|
||
trait :date_condition do | ||
name { Factory.create(:date_custom_field).id } | ||
operator 'gt' | ||
value { '1/1/2001' } | ||
end | ||
|
||
factory :date_group_condition, :traits => [ :date_condition ] | ||
factory :text_group_condition, :traits => [ :text_condition ] | ||
factory :number_group_condition,:traits => [ :number_condition ] | ||
factory :price_group_condition, :traits => [ :price_condition ] | ||
factory :name_group_condition, :traits => [ :name_condition ] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FactoryGirl.define do | ||
factory :product_group do | ||
sequence(:name) { |t| "name#{t}" } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FactoryGirl.define do | ||
factory :product do | ||
sequence(:name) { |t| "name#{t}" } | ||
sequence(:description) { |t| "This is product description#{t}" } | ||
price 50 | ||
|
||
# When a product is created through admin interface then carrierwave creates a record for each product | ||
# even if no picture is uploaded | ||
after_create { |product| product.pictures.create } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FactoryGirl.define do | ||
factory :regional_shipping_zone do |f| | ||
country_shipping_zone | ||
code "AL" | ||
name "ALABAMA" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FactoryGirl.define do | ||
factory :shipping_method do | ||
sequence(:name) { |t| "name#{t}" } | ||
|
||
trait :country do | ||
association :shipping_zone, :factory => :country_shipping_zone | ||
lower_price_limit 10 | ||
upper_price_limit 20 | ||
base_price 2.99 | ||
end | ||
|
||
trait :regional do | ||
association :shipping_zone, :factory => :regional_shipping_zone | ||
offset 1.00 | ||
association :parent, :factory => :country_shipping_method | ||
end | ||
|
||
factory :country_shipping_method, traits: [:country] | ||
factory :regional_shipping_method, traits: [:regional] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FactoryGirl.define do | ||
factory :shop do |f| | ||
sequence(:name){|n| "store-#{n}"} | ||
twitter_handle '@nimbleshop' | ||
intercept_email 'johnnie.walker@nimbleshop.com' | ||
from_email 'support@nimbleshop.com' | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FactoryGirl.define do | ||
factory :variant do |f| | ||
product | ||
price 100 | ||
variation1_value 'v1' | ||
variation2_value 'v2' | ||
variation3_value 'v3' | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FactoryGirl.define do | ||
factory :variantion do |f| | ||
product | ||
name 'Color' | ||
variation_type 'variation1' | ||
active false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
record1: | ||
order_id: 1 | ||
transaction_gid: 21786353 | ||
amount: 100.0 | ||
creditcard_id: 200 | ||
status: t | ||
params: ! '--- | ||
amount: 106.00 | ||
creditcard_id: 1 | ||
active: true | ||
status: authorized |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
record1: | ||
masked_number: XXXX-XXXX-XXXX-0027 | ||
expires_on: <%= 2.months.from_now %> | ||
cardtype: visa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "spec_helper" | ||
|
||
describe Mailer do | ||
|
||
before do | ||
ActionMailer::Base.deliveries.clear | ||
end | ||
|
||
let(:order) { create(:order) } | ||
|
||
describe '#order_notification' do | ||
it 'should have one creditcard record if fixtures are read properly' do | ||
Creditcard.count.must_equal 1 | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require 'bundler' | ||
|
||
Bundler.setup(:test) | ||
|
||
ENV["RAILS_ENV"] = "test" | ||
|
||
require File.expand_path('../../config/environment', __FILE__) | ||
|
||
require 'minitest/autorun' | ||
require 'minitest/spec' | ||
require "minitest/rails" | ||
require "minitest/pride" | ||
require "capybara/rails" | ||
require 'database_cleaner' | ||
#require "capybara-webkit" | ||
require 'rails/test_help' | ||
|
||
#Capybara.default_driver = :webkit | ||
|
||
# Require ruby files in support dir. | ||
Dir[File.expand_path('spec/support/*.rb')].each { |file| require file } | ||
|
||
# Do not change to :transaction since :truncation is much faster. | ||
DatabaseCleaner.strategy = :truncation | ||
|
||
class MiniTest::Spec | ||
include Factory::Syntax::Methods | ||
include ActiveSupport::Testing::SetupAndTeardown | ||
include ActiveRecord::TestFixtures | ||
|
||
alias :method_name :__name__ if defined? :__name__ | ||
self.fixture_path = File.join(Rails.root, 'spec', 'fixtures') | ||
fixtures :all | ||
|
||
# Add methods to be used by all specs here... | ||
before :each do | ||
DatabaseCleaner.clean | ||
|
||
create(:shop) | ||
create(:link_group, name: "Shop by category", permalink: 'shop-by-category') | ||
create(:link_group, name: "Shop by price", permalink: 'shop-by-price') | ||
PaymentMethod.load_default! | ||
end | ||
end | ||
|
||
|
||
def create_authorizenet_payment_method | ||
unless PaymentMethod.find_by_permalink('authorize-net') | ||
payment_method = PaymentMethod::AuthorizeNet.create!(name: 'Authorize.net') | ||
payment_method.authorize_net_login_id = '56yBAar72' | ||
payment_method.authorize_net_transaction_key = '9r3pbH5bnKH29f7d' | ||
payment_method.save! | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Object | ||
def must_be_like other | ||
gsub(/\s+/, ' ').strip.must_equal other.gsub(/\s+/, ' ').strip | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class RequestSpec < MiniTest::Spec | ||
include Capybara::DSL | ||
include Rails.application.routes.url_helpers | ||
end | ||
|
||
MiniTest::Spec.register_spec_type /integration$/i, RequestSpec |