Adding initial controller specs. Both failing

This commit is contained in:
Michael Bianco
2012-08-07 10:48:36 -04:00
parent 95e9b97abe
commit c997f03bc1
4 changed files with 51 additions and 19 deletions

View File

@@ -11,6 +11,6 @@ group :test do
end
end
gem 'spree', '~> 1.1.2'
gem 'spree', '~> 1.1.3'
gemspec

View 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

View File

@@ -81,7 +81,6 @@ describe Spree::Order do
order.rate_hash.count.should == 1
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
end
end

View File

@@ -1,34 +1,24 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
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/env'
require 'spree/core/testing_support/controller_requests'
require 'spree/core/url_helpers'
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
# Remove this line if you're not using ActiveRecord or ActiveRecord 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.include Spree::Core::UrlHelpers
config.include Spree::Core::TestingSupport::ControllerRequests
config.include Devise::TestHelpers, :type => :controller
end
Dir[File.join(File.dirname(__FILE__), "factories/*.rb")].each {|f| require f }