Skip to content

Commit

Permalink
Add poltergeist
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmay3011 committed Nov 8, 2017
1 parent 933e3ca commit cae00fc
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/spree/order_contents_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ def grab_line_item_by_variant_with_gift_card(variant, raise_error = false, optio

grab_line_item_by_variant_without_gift_card(variant, raise_error, options)
end
alias_method_chain :grab_line_item_by_variant, :gift_card
alias_method :orig_grab_line_item_by_variant, :grab_line_item_by_variant
end
1 change: 0 additions & 1 deletion gemfiles/spree_3_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
source "https://rubygems.org"

gem "spree", "~> 3.2.0"
gem "byebug"
gem "rails-controller-testing", "~> 1.0.1"

group :test do
Expand Down
1 change: 0 additions & 1 deletion gemfiles/spree_3_3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
source "https://rubygems.org"

gem "spree", "~> 3.3.0"
gem "byebug"
gem "rails-controller-testing", "~> 1.0.1"

group :test do
Expand Down
1 change: 0 additions & 1 deletion gemfiles/spree_master.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
source "https://rubygems.org"

gem "spree", github: "spree/spree", branch: "master"
gem "byebug"
gem "rails-controller-testing", "~> 1.0.1"

group :test do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/gift_card_administration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
within 'table.index' do
expect(page).to have_content('First Last')
find('[data-action="remove"]').click
page.driver.browser.switch_to.alert.accept
# page.driver.browser.switch_to.alert.accept
end
sleep 1
expect(Spree::GiftCard.count).to eql(0)
Expand Down
3 changes: 2 additions & 1 deletion spec/features/checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe "Checkout", js: true do

let!(:country) { create(:country, name: "United States of America", states_required: true) }
let!(:country) { create(:country, name: "United States of America", states_required: false) }
let!(:state) { create(:state, name: "Alabama", country: country) }
let!(:shipping_method) { create(:shipping_method) }
let!(:stock_location) { create(:stock_location) }
Expand All @@ -12,6 +12,7 @@
let!(:zone) { create(:zone) }

before do
Spree::Config[:address_requires_state] = false
create(:gift_card, code: "foobar", variant: create(:variant, price: 5))
end

Expand Down
3 changes: 2 additions & 1 deletion spec/features/purchase_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

feature "Purchase Gift Card", js: true do

let!(:country) { create(:country, name: "United States of America", states_required: true) }
let!(:country) { create(:country, name: "United States of America", states_required: false) }
let!(:state) { create(:state, name: "Alabama", country: country) }
let!(:shipping_method) { create(:shipping_method) }
let!(:stock_location) { create(:stock_location) }
Expand All @@ -11,6 +11,7 @@
let!(:zone) { create(:zone) }

before do
Spree::Config[:address_requires_state]
## TODO seed helper for gc
product = Spree::Product.new(available_on: Time.now, name: "Gift Card", is_gift_card: true, slug: 'gift-card', price: 0, shipping_category_id: shipping_method.shipping_categories.first.id)
option_type = Spree::OptionType.new(name: "is-gift-card", presentation: "Value")
Expand Down
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

require 'database_cleaner'
require 'factory_bot'
FactoryBot.find_definitions
require 'ffaker'
require 'shoulda-matchers'

Expand All @@ -32,6 +31,8 @@
require 'spree/testing_support/capybara_ext'
require 'spree/testing_support/url_helpers'
require 'rspec/active_model/mocks'
require 'spree_gift_card/factories'
require 'capybara/poltergeist'

RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
Expand All @@ -52,6 +53,8 @@
DatabaseCleaner.start
end

Capybara.javascript_driver = :poltergeist

config.after :each do
DatabaseCleaner.clean
end
Expand Down
1 change: 1 addition & 0 deletions spree_gift_card.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'rspec-activemodel-mocks'
s.add_development_dependency 'rails-controller-testing', '~> 1.0.1'
s.add_development_dependency 'poltergeist'
end

0 comments on commit cae00fc

Please sign in to comment.