Adding initial controller specs. Both failing
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -11,6 +11,6 @@ group :test do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'spree', '~> 1.1.2'
|
gem 'spree', '~> 1.1.3'
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|||||||
43
spec/controllers/digitals_controller_spec.rb
Normal file
43
spec/controllers/digitals_controller_spec.rb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Spree::Admin::DigitalsController do
|
||||||
|
before do
|
||||||
|
@product = FactoryGirl.create :product
|
||||||
|
|
||||||
|
controller.stub :authorize! => true
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:product) { @product }
|
||||||
|
|
||||||
|
context "with variants" do
|
||||||
|
before do
|
||||||
|
# TODO add variants with digital
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should display an empty page when no digitals exist" do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should display list of digitals when they exist" do
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "without variants" do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
it "should display an empty page when no digitals exist" do
|
||||||
|
spree_get :index, "product_id" => product.permalink
|
||||||
|
response.code.should == "200"
|
||||||
|
response.body.should include("This product has no variants")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should display list of digitals when they exist" do
|
||||||
|
@digital = FactoryGirl.create :digital, :variant => product.master
|
||||||
|
spree_get :index, :product_id => product.permalink
|
||||||
|
response.code.should == "200"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -81,7 +81,6 @@ describe Spree::Order do
|
|||||||
|
|
||||||
order.rate_hash.count.should == 1
|
order.rate_hash.count.should == 1
|
||||||
order.rate_hash.first.shipping_method.calculator.class.should_not == Spree::Calculator::DigitalDelivery
|
order.rate_hash.first.shipping_method.calculator.class.should_not == Spree::Calculator::DigitalDelivery
|
||||||
puts "SHIPP #{order.rate_hash.first}"
|
|
||||||
order.rate_hash.first.cost.should == 10.0
|
order.rate_hash.first.cost.should == 10.0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,34 +1,24 @@
|
|||||||
# Configure Rails Environment
|
|
||||||
ENV["RAILS_ENV"] = "test"
|
ENV["RAILS_ENV"] = "test"
|
||||||
|
|
||||||
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
||||||
|
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
|
|
||||||
# Requires supporting ruby files with custom matchers and macros, etc,
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
# in spec/support/ and its subdirectories.
|
# in spec/support/ and its subdirectories.
|
||||||
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
|
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
|
||||||
|
|
||||||
# Requires factories defined in spree_core
|
|
||||||
require 'spree/core/testing_support/factories'
|
require 'spree/core/testing_support/factories'
|
||||||
|
require 'spree/core/testing_support/env'
|
||||||
|
require 'spree/core/testing_support/controller_requests'
|
||||||
|
require 'spree/core/url_helpers'
|
||||||
|
|
||||||
RSpec.configure do |config|
|
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
|
config.mock_with :rspec
|
||||||
|
|
||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
# 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 = true
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
config.include Spree::Core::UrlHelpers
|
||||||
|
config.include Spree::Core::TestingSupport::ControllerRequests
|
||||||
|
config.include Devise::TestHelpers, :type => :controller
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir[File.join(File.dirname(__FILE__), "factories/*.rb")].each {|f| require f }
|
Dir[File.join(File.dirname(__FILE__), "factories/*.rb")].each {|f| require f }
|
||||||
|
|||||||
Reference in New Issue
Block a user