Skip to content

Commit a918b8b

Browse files
authored
Merge pull request #222 from nebulab/elia/already-initialized-constant
Specs and setup process housekeeping
2 parents 3addfb3 + 29de6bc commit a918b8b

4 files changed

Lines changed: 32 additions & 18 deletions

File tree

Rakefile

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,38 @@
33
require 'bundler'
44
Bundler::GemHelper.install_tasks
55

6-
require 'rspec/core/rake_task'
6+
require 'rake/clean'
77
require 'spree/testing_support/common_rake'
8+
ENV['DUMMY_PATH'] = "spec/dummy"
9+
ENV['LIB_NAME'] = "solidus/auth"
10+
::CLOBBER.include ENV['DUMMY_PATH']
811

9-
RSpec::Core::RakeTask.new
12+
namespace :extension do
13+
# We need to go back to the gem root since the upstream
14+
# extension:test_app changes the working directory to be the dummy app.
15+
task :test_app do
16+
Rake::Task['extension:test_app'].invoke
17+
cd __dir__
18+
end
1019

11-
task :default do
12-
if Dir["spec/dummy"].empty?
13-
Rake::Task[:test_app].invoke
14-
Dir.chdir("../../")
20+
directory ENV['DUMMY_PATH'] do
21+
Rake::Task['common:test_app'].invoke("Spree::User")
1522
end
16-
Rake::Task[:spec].invoke
17-
end
1823

19-
desc 'Generates a dummy app for testing'
20-
task :test_app do
21-
ENV['LIB_NAME'] = 'solidus/auth'
22-
Rake::Task['common:test_app'].invoke("Spree::User")
24+
require 'rspec/core/rake_task'
25+
RSpec::Core::RakeTask.new(:specs, [] => FileList[ENV['DUMMY_PATH']]) do |t|
26+
# Ref: https://circleci.com/docs/2.0/configuration-reference#store_test_results
27+
# Ref: https://github.com/solidusio/circleci-orbs-extensions#test-results-rspec
28+
if ENV['TEST_RESULTS_PATH']
29+
t.rspec_opts =
30+
"--format progress " \
31+
"--format RspecJunitFormatter --out #{ENV['TEST_RESULTS_PATH']}"
32+
end
33+
end
2334
end
35+
36+
task default: 'extension:specs'
37+
38+
# DEPRECATED:
39+
task test_app: 'extension:test_app'
40+
task spec: 'extension:specs'

lib/decorators/frontend/controllers/spree/checkout_controller_decorator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def self.prepended(base)
77
base.before_action :check_authorization
88

99
# This action builds some associations on the order, ex. addresses, which we
10-
# don't to build or save here.
10+
# don't want to build or save here.
1111
base.skip_before_action :setup_for_current_state, only: [:registration, :update_registration]
1212
end
1313

spec/features/order_spec.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88

99
# regression test for spree/spree#1687
1010
scenario 'merge incomplete orders from different sessions' do
11-
skip %{
12-
TODO: has been broken for ~2 months as of:
13-
https://github.com/spree/spree_auth_devise/commit/3157b47b22c559817d34ec34024587d8aa6136dc
14-
I dont think we can decode these sessions anymore since Rails 4 switched to encrypted cookies I believe devise stores session encrypted.
15-
}
11+
create(:store)
1612
create(:product, name: 'RoR Mug')
1713
create(:product, name: 'RoR Shirt')
1814

spec/support/confirm_helpers.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
begin
99
example.run
1010
ensure
11+
Spree.send(:remove_const, :User)
1112
Spree.const_set('User', old_user)
1213
end
1314
else

0 commit comments

Comments
 (0)