Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bringing the testing enviornment up to speed: Guard, Growl, new Facto…

…ryGirl syntax
  • Loading branch information...
commit 6d6413bdc3d484ae963426b988d4e7769a6ca3b9 1 parent 54ad1d9
@iloveitaly iloveitaly authored radar committed
View
4 .rspec
@@ -1,6 +1,4 @@
--colour
--format
progress
---loadby
-mtime
---reverse
+mtime
View
7 Gemfile
@@ -1,16 +1,13 @@
source 'http://rubygems.org'
-# temporarily needed until next capybara release
-gem 'sqlite3'
-
group :test do
gem 'rspec-rails', '~> 2.9.0'
gem 'factory_girl', '~> 2.6.4'
gem 'factory_girl_rails', '~> 1.7'
+ gem 'sqlite3'
gem 'faker'
gem 'shoulda-matchers'
end
-gemspec
-
gem 'spree', :git => 'https://github.com/spree/spree', :branch => "1-1-stable"
+gemspec
View
19 Guardfile
@@ -0,0 +1,19 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'rspec', :version => 2 do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+
+ # Rails example
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
+ watch('config/routes.rb') { "spec/routing" }
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
+ # Capybara request specs
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
+end
+
View
4 spec/models/spree/line_item_spec.rb
@@ -2,8 +2,8 @@
describe Spree::LineItem do
before :each do
- @order = Factory.create(:order)
- @variant = Factory.create(:variant, :price => 10)
+ @order = FactoryGirl.create(:order)
+ @variant = FactoryGirl.create(:variant, :price => 10)
@variant.volume_prices.create! :amount => 9, :range => '(2+)'
@order.add_variant(@variant, 1)
@line_item = @order.line_items.first
View
12 spec/models/spree/order_spec.rb
@@ -2,12 +2,12 @@
describe Spree::Order do
before(:each) do
- @order = Factory.create(:order)
- @variant = Factory.create(:variant, :price => 10)
+ @order = FactoryGirl.create(:order)
+ @variant = FactoryGirl.create(:variant, :price => 10)
- @variant_with_prices = Factory.create(:variant, :price => 10)
- @variant_with_prices.volume_prices << Factory.create(:volume_price, :range => '(1..5)', :amount => 9)
- @variant_with_prices.volume_prices << Factory.create(:volume_price, :range => '(5..9)', :amount => 8)
+ @variant_with_prices = FactoryGirl.create(:variant, :price => 10)
+ @variant_with_prices.volume_prices << FactoryGirl.create(:volume_price, :range => '(1..5)', :amount => 9)
+ @variant_with_prices.volume_prices << FactoryGirl.create(:volume_price, :range => '(5..9)', :amount => 8)
end
describe "add_variant" do
@@ -17,7 +17,7 @@
end
it "should use the volume price if quantity falls within a quantity range of a volume price" do
- @variant.volume_prices << Factory.create(:volume_price, :range => '(5..10)', :amount => 9)
+ @variant.volume_prices << FactoryGirl.create(:volume_price, :range => '(5..10)', :amount => 9)
@order.add_variant(@variant_with_prices, 7)
@order.line_items.first.price.should == 8
end
Please sign in to comment.
Something went wrong with that request. Please try again.