diff --git a/.gitignore b/.gitignore index 39a875e..2030494 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ nbproject spec/dummy *.tmproj Gemfile.lock +Guardfile + diff --git a/Gemfile b/Gemfile index ff9e196..bc63e9e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,16 +1,12 @@ source 'http://rubygems.org' +gemspec group :test do - gem 'ffaker' - gem 'shoulda-matchers' - gem 'guard-rspec' - if RUBY_PLATFORM.downcase.include? "darwin" + gem 'guard-rspec' gem 'rb-fsevent' gem 'growl' end end gem 'spree', '~> 1.1.3' - -gemspec diff --git a/Guardfile b/Guardfile deleted file mode 100644 index 2517982..0000000 --- a/Guardfile +++ /dev/null @@ -1,18 +0,0 @@ - - -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 - diff --git a/spec/models/digital_link_spec.rb b/spec/models/digital_link_spec.rb index d59714b..2b52ea9 100644 --- a/spec/models/digital_link_spec.rb +++ b/spec/models/digital_link_spec.rb @@ -1,11 +1,10 @@ -require File.dirname(__FILE__) + '/../spec_helper' +require 'spec_helper' describe Spree::DigitalLink do context 'validation' do it { should belong_to(:digital) } it { should belong_to(:line_item) } - it { should have_valid_factory(:digital_link) } end context "#create" do diff --git a/spec/models/digital_spec.rb b/spec/models/digital_spec.rb index 169a1e1..cbd7e27 100644 --- a/spec/models/digital_spec.rb +++ b/spec/models/digital_spec.rb @@ -4,7 +4,6 @@ describe Spree::Digital do context 'validation' do it { should belong_to(:variant) } - it { should have_valid_factory(:digital) } end context "#create" do diff --git a/spec/models/line_item_spec.rb b/spec/models/line_item_spec.rb index 97dbc0e..2696695 100644 --- a/spec/models/line_item_spec.rb +++ b/spec/models/line_item_spec.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../spec_helper' +require 'spec_helper' describe Spree::LineItem do diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb index 8314c82..aa6e780 100644 --- a/spec/models/order_spec.rb +++ b/spec/models/order_spec.rb @@ -1,11 +1,6 @@ -require File.dirname(__FILE__) + '/../spec_helper' +require 'spec_helper' describe Spree::Order do - - context 'validation' do - it { should have_valid_factory(:order) } - end - context "#add_variant" do it "should add digital Variants of quantity 1 to an order" do order = FactoryGirl.create(:order) diff --git a/spec/models/variant_spec.rb b/spec/models/variant_spec.rb index 4a88dba..a8a0cf2 100644 --- a/spec/models/variant_spec.rb +++ b/spec/models/variant_spec.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../spec_helper' +require 'spec_helper' describe Spree::Variant do context "#destroy" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 111c532..8cefa8f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,8 @@ ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) require 'rspec/rails' require 'database_cleaner' +require 'ffaker' +require 'shoulda-matchers' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -16,15 +18,10 @@ Dir[File.join(File.dirname(__FILE__), "factories/*.rb")].each {|f| require f } RSpec.configure do |config| config.mock_with :rspec - config.fixture_path = "#{::Rails.root}/spec/fixtures" - + config.include FactoryGirl::Syntax::Methods config.include Spree::Core::UrlHelpers config.include Spree::Core::TestingSupport::ControllerRequests config.include Devise::TestHelpers, :type => :controller - - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. config.use_transactional_fixtures = false config.before(:each) do @@ -43,11 +40,4 @@ RSpec.configure do |config| config.after(:each) do DatabaseCleaner.clean end -end - -# not sure if this really adds anything, but this existed in the intial version of the spree_digital rspec testing -RSpec::Matchers.define :have_valid_factory do |factory_name| - match do |model| - FactoryGirl.create(factory_name).new_record?.should be_false - end end \ No newline at end of file diff --git a/spree_digital.gemspec b/spree_digital.gemspec index 5f360ee..7ed333e 100644 --- a/spree_digital.gemspec +++ b/spree_digital.gemspec @@ -17,8 +17,8 @@ Gem::Specification.new do |s| s.add_development_dependency 'shoulda-matchers' s.add_development_dependency 'capybara' s.add_development_dependency 'factory_girl_rails', '~> 1.7.0' - s.add_development_dependency 'ffaker' - s.add_development_dependency 'rspec-rails' + s.add_development_dependency 'rspec-rails', '~> 2.8' s.add_development_dependency 'sqlite3' + s.add_development_dependency 'ffaker' s.add_development_dependency 'database_cleaner' end \ No newline at end of file