Skip to content

Commit bec0dfd

Browse files
authored
Merge pull request #1 from deseretbook/migrate_to_solidus
Migrate to solidus
2 parents fed4458 + dbe99ee commit bec0dfd

File tree

13 files changed

+51
-49
lines changed

13 files changed

+51
-49
lines changed

Gemfile

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
source 'https://rubygems.org'
22

3-
spree_branch = "2-2-stable"
4-
gem 'spree_core', github: 'spree/spree', branch: spree_branch
5-
gem 'spree_backend', github: 'spree/spree', branch: spree_branch
6-
gem 'spree_api', github: 'spree/spree', branch: spree_branch
7-
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: spree_branch
8-
gem 'spree_i18n', github: 'spree/spree_i18n', branch: spree_branch
3+
gem 'therubyracer', group: :development
4+
5+
gem 'solidus', '~> 1.3.0'
6+
gem 'solidus_auth_devise'
7+
gem 'solidus_backend'
8+
gem 'solidus_api'
9+
gem 'solidus_i18n'
10+
11+
group :development, :test do
12+
# Call `binding.pry` anywhere in the code to stop execution and get a debugger console.
13+
gem 'byebug'
14+
gem 'pry-byebug'
15+
end
916

1017
gemspec

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
Spree Notes
1+
Solidus Notes
22
================
33

44
Installation
55
------------
66

77
Add to `Gemfile`:
88

9-
gem 'spree_notes', :git => 'git://github.com/railsdog/spree_notes.git'
9+
gem 'solidus_notes', :git => 'git://github.com/deseretbook/solidus_notes.git'
1010

1111
Run:
1212

1313
$ bundle
14-
$ bundle exec rails g spree_notes:install
14+
$ bundle exec rails g solidus_notes:install
1515

1616
Development
1717
-----------

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ task :default => [:spec]
99

1010
desc "Generates a dummy app for testing"
1111
task :test_app do
12-
ENV['LIB_NAME'] = 'spree_notes'
12+
ENV['LIB_NAME'] = 'solidus_notes'
1313
Rake::Task['common:test_app'].invoke
1414
end

app/assets/stylesheets/spree/backend/spree_notes.css.scss app/assets/stylesheets/spree/backend/solidus_notes.scss

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
@import 'spree/backend/globals/functions';
22
@import 'spree/backend/globals/variables_override';
33
@import 'spree/backend/globals/variables';
4-
@import 'spree/backend/globals/mixins';
54

65
.important-notes-banner{
76
.important-notes-banner-inner{
87
width: 80%;
98
padding: 7px;
109
border: 1px solid $color-action-void-brd;
1110
background-color: $color-action-void-bg;
12-
@include border-radius(3px);
11+
border-radius: 3px;
1312
color: $color-error;
1413
}
1514
}
@@ -20,7 +19,7 @@
2019
float: left;
2120
margin-bottom: 15px;
2221
border: 1px solid $color-border;
23-
@include border-radius(3px);
22+
border-radius: 3px;
2423

2524
.note-icon{
2625
float: left;

db/migrate/20140627182438_create_spree_notes.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def change
55
t.column :body, :text
66
t.column :important, :boolean, default: false
77
t.column :author, :string
8-
t.timestamps
8+
t.timestamps null: true
99
end
1010
end
1111
end

lib/generators/spree_notes/install/install_generator.rb lib/generators/solidus_notes/install/install_generator.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
module SpreeNotes
1+
module SolidusNotes
22
module Generators
33
class InstallGenerator < Rails::Generators::Base
44
class_option :auto_run_migrations, :type => :boolean, :default => false
55

66
def add_javascripts
7-
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_notes\n"
7+
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_notes\n"
88
end
99

1010
def add_stylesheets
11-
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/spree_notes\n", :before => /\*\//, :verbose => true
11+
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_notes\n", :before => /\*\//, :verbose => true
1212
end
1313

1414
def add_migrations
15-
run 'bundle exec rake railties:install:migrations FROM=spree_notes'
15+
run 'bundle exec rake railties:install:migrations FROM=solidus_notes'
1616
end
1717

1818
def run_migrations

lib/spree_notes.rb lib/solidus_notes.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
require 'spree_backend'
2-
require 'spree_core'
1+
require 'solidus_backend'
2+
require 'solidus_core'
33

4-
module SpreeNotes
4+
module SolidusNotes
55
class Engine < Rails::Engine
6-
require 'spree/core'
76
isolate_namespace Spree
8-
engine_name 'spree_notes'
7+
engine_name 'solidus_notes'
98

109
def self.activate
1110
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|

spree_notes.gemspec solidus_notes.gemspec

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.platform = Gem::Platform::RUBY
3-
s.name = 'spree_notes'
3+
s.name = 'solidus_notes'
44
s.version = '0.0.2'
55
s.summary = 'Allows admins to add custom notes to orders and users'
66
s.description = 'Allows admins to add custom notes to orders and users'
@@ -17,13 +17,13 @@ Gem::Specification.new do |s|
1717

1818
# s.has_rdoc = true
1919

20-
s.add_development_dependency 'factory_girl', '4.4'
20+
s.add_development_dependency 'factory_girl'
2121
s.add_development_dependency 'ffaker'
22-
s.add_development_dependency 'rspec-rails', '2.14'
23-
s.add_development_dependency 'sqlite3', '~> 1.3.8'
24-
s.add_development_dependency 'capybara', '~> 2.2.1'
25-
s.add_development_dependency 'poltergeist', '~> 1.5.0'
26-
s.add_development_dependency 'database_cleaner', '~> 1.2.0'
27-
s.add_development_dependency 'sass-rails', '~> 4.0.0'
22+
s.add_development_dependency 'rspec-rails'
23+
s.add_development_dependency 'sqlite3'
24+
s.add_development_dependency 'capybara'
25+
s.add_development_dependency 'poltergeist'
26+
s.add_development_dependency 'database_cleaner'
27+
s.add_development_dependency 'sass-rails'
2828
s.add_development_dependency 'pry-rails'
2929
end

spec/features/edit_admin_order_spec.rb

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
require 'spec_helper'
2-
3-
describe 'notes on edit admin order page' do
4-
before(:each) do
1+
describe 'notes on edit admin order page', type: :feature do
2+
before(:each) do
53
admin_user = create(:admin_user)
6-
stub_admin_login! admin_user
4+
stub_admin_login!(admin_user)
75
end
86

97
context 'creating', js: true do
@@ -14,14 +12,14 @@
1412
end
1513

1614
it 'does not show the create note form initially' do
17-
expect(find('.js-create-note-form', visible: false).visible?).to be_false
15+
expect(find('.js-create-note-form', visible: false).visible?).to be false
1816
end
1917

2018
it 'shows the create note form after clicking the create note button' do
2119
within_fieldset 'admin_order_edit_notes' do
2220
click_button 'Create New Note'
2321
end
24-
expect(find('.js-create-note-form', visible: false).visible?).to be_true
22+
expect(find('.js-create-note-form', visible: false).visible?).to be true
2523
end
2624

2725
it 'can successfully create an unimportant note' do

spec/features/edit_admin_user_spec.rb

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
require 'spec_helper'
2-
3-
describe 'notes on edit admin user page' do
4-
before(:each) do
1+
describe 'notes on edit admin user page', type: :feature do
2+
before(:each) do
53
admin_user = create(:admin_user)
6-
stub_admin_login! admin_user
4+
stub_admin_login!(admin_user)
75
end
86

97
context 'creating', js: true do
@@ -14,14 +12,14 @@
1412
end
1513

1614
it 'does not show the create note form initially' do
17-
expect(find('.js-create-note-form', visible: false).visible?).to be_false
15+
expect(find('.js-create-note-form', visible: false).visible?).to be false
1816
end
1917

2018
it 'shows the create note form after clicking the create note button' do
2119
within_fieldset 'admin_user_edit_notes' do
2220
click_button 'Create New Note'
2321
end
24-
expect(find('.js-create-note-form', visible: false).visible?).to be_true
22+
expect(find('.js-create-note-form', visible: false).visible?).to be true
2523
end
2624

2725
it 'can successfully create an unimportant note' do

spec/models/spree/notes_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@
3333

3434
it '.important scope returns only important notes' do
3535
Spree::Note.important.each do |note|
36-
expect(note.important).to be_true
36+
expect(note.important).to be true
3737
end
3838
end
3939

4040
it '.not_important scope returns only unimportant notes' do
4141
Spree::Note.not_important.each do |note|
42-
expect(note.important).to be_false
42+
expect(note.important).to be false
4343
end
4444
end
4545

4646
context 'finders always return notes ordered' do
4747
it 'with important notes first primarily' do
4848
Spree::Note.all.each_cons(2) do |current_note, next_note|
4949
if current_note.important != next_note.important
50-
expect(next_note.important).to be_false
50+
expect(next_note.important).to be false
5151
end
5252
end
5353
end

spec/spec_helper.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# Testing support from spree_core
1414
require 'spree/testing_support/factories'
1515
require 'spree/testing_support/flash'
16+
require 'spree/testing_support/authorization_helpers'
1617

1718
# Requires supporting ruby files with custom matchers and macros, etc,
1819
# in spec/support/ and its subdirectories.
@@ -41,7 +42,7 @@
4142

4243
# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
4344
config.before :each do
44-
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
45+
DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
4546
DatabaseCleaner.start
4647
end
4748

0 commit comments

Comments
 (0)