wagons 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Rakefile +4 -6
- data/lib/generators/wagon/templates/%singular_name%.gemspec.tt +12 -11
- data/lib/generators/wagon/templates/{script → bin}/rails.tt +3 -2
- data/lib/generators/wagon/templates/config/routes.rb +1 -1
- data/lib/generators/wagon/templates/lib/%singular_name%/version.rb.tt +2 -2
- data/lib/generators/wagon/templates/lib/%singular_name%.rb.tt +0 -1
- data/lib/generators/wagon/wagon_generator.rb +4 -6
- data/lib/wagons/extensions/application.rb +2 -4
- data/lib/wagons/extensions/require_optional.rb +2 -2
- data/lib/wagons/extensions/test_case.rb +5 -7
- data/lib/wagons/installer.rb +52 -56
- data/lib/wagons/railtie.rb +2 -2
- data/lib/wagons/version.rb +1 -1
- data/lib/wagons/view_helper.rb +14 -16
- data/lib/wagons/wagon.rb +6 -8
- data/lib/wagons.rb +8 -10
- data/test/ci/rails3.gemfile.lock +108 -0
- data/test/dummy/Gemfile.lock +52 -48
- data/test/dummy/app/controllers/people_controller.rb +1 -3
- data/test/dummy/app/models/person.rb +1 -1
- data/test/dummy/config/application.rb +3 -4
- data/test/dummy/config/boot.rb +1 -1
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/initializers/wagon_app_version.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/test/dummy/config/routes.rb +3 -3
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/fixtures/development/people.rb +3 -3
- data/test/dummy/db/fixtures/test/people.rb +3 -3
- data/test/dummy/db/schema.rb +5 -5
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +1528 -1015
- data/test/dummy/log/test.log +11807 -6530
- data/test/dummy/test/models/person_test.rb +5 -5
- data/test/dummy/test/test_helper.rb +1 -1
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/vendor/wagons/superliner/Gemfile.lock +53 -49
- data/test/dummy/vendor/wagons/superliner/app/controllers/cities_controller.rb +1 -2
- data/test/dummy/vendor/wagons/superliner/app/models/city.rb +2 -2
- data/test/dummy/vendor/wagons/superliner/db/fixtures/cities.rb +1 -1
- data/test/dummy/vendor/wagons/superliner/db/migrate/20120606125058_create_cities.rb +1 -1
- data/test/dummy/vendor/wagons/superliner/dummy_superliner.gemspec +11 -11
- data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/version.rb +2 -2
- data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner/wagon.rb +3 -4
- data/test/dummy/vendor/wagons/superliner/lib/dummy_superliner.rb +1 -1
- data/test/dummy/vendor/wagons/superliner/script/rails +1 -1
- data/test/dummy/vendor/wagons/superliner/test/controllers/cities_controller_test.rb +5 -7
- data/test/dummy/vendor/wagons/superliner/test/controllers/people_controller_test.rb +2 -4
- data/test/dummy/vendor/wagons/superliner/test/models/city_test.rb +3 -3
- data/test/dummy/vendor/wagons/superliner/test/models/person_test.rb +5 -7
- data/test/dummy/vendor/wagons/superliner/test/test_helper.rb +1 -2
- data/test/dummy/vendor/wagons/superliner/test/wagon_test.rb +23 -24
- data/test/test_helper.rb +5 -5
- data/test/wagons_installer_test.rb +72 -75
- data/test/wagons_test.rb +1 -1
- metadata +174 -160
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PersonTest < ActiveSupport::TestCase
|
4
|
-
test
|
4
|
+
test 'person without name is invalid' do
|
5
5
|
person = Person.new
|
6
6
|
assert !person.valid?
|
7
7
|
end
|
8
|
-
|
9
|
-
test
|
8
|
+
|
9
|
+
test 'person has no idea about a city' do
|
10
10
|
person = Person.new
|
11
11
|
assert_raise(NoMethodError) do
|
12
12
|
person.city_id = 42
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
16
|
-
test
|
15
|
+
|
16
|
+
test 'wagon models are not loaded in main application tests' do
|
17
17
|
assert_raise(NameError) do
|
18
18
|
City.new
|
19
19
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -4,9 +4,9 @@ PATH
|
|
4
4
|
dummy_superliner (0.0.1)
|
5
5
|
|
6
6
|
PATH
|
7
|
-
remote: /
|
7
|
+
remote: /Users/pascal/Code/ruby/wagons
|
8
8
|
specs:
|
9
|
-
wagons (0.
|
9
|
+
wagons (0.3.0)
|
10
10
|
bundler (>= 1.1)
|
11
11
|
rails (>= 3.2)
|
12
12
|
seed-fu-ndo (>= 0.0.2)
|
@@ -15,86 +15,90 @@ GEM
|
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
remote: https://rubygems.org/
|
17
17
|
specs:
|
18
|
-
actionmailer (4.
|
19
|
-
actionpack (= 4.
|
18
|
+
actionmailer (4.1.1)
|
19
|
+
actionpack (= 4.1.1)
|
20
|
+
actionview (= 4.1.1)
|
20
21
|
mail (~> 2.5.4)
|
21
|
-
actionpack (4.
|
22
|
-
|
23
|
-
|
24
|
-
erubis (~> 2.7.0)
|
22
|
+
actionpack (4.1.1)
|
23
|
+
actionview (= 4.1.1)
|
24
|
+
activesupport (= 4.1.1)
|
25
25
|
rack (~> 1.5.2)
|
26
26
|
rack-test (~> 0.6.2)
|
27
|
-
|
28
|
-
activesupport (= 4.
|
29
|
-
builder (~> 3.1
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
27
|
+
actionview (4.1.1)
|
28
|
+
activesupport (= 4.1.1)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubis (~> 2.7.0)
|
31
|
+
activemodel (4.1.1)
|
32
|
+
activesupport (= 4.1.1)
|
33
|
+
builder (~> 3.1)
|
34
|
+
activerecord (4.1.1)
|
35
|
+
activemodel (= 4.1.1)
|
36
|
+
activesupport (= 4.1.1)
|
37
|
+
arel (~> 5.0.0)
|
38
|
+
activesupport (4.1.1)
|
39
|
+
i18n (~> 0.6, >= 0.6.9)
|
40
|
+
json (~> 1.7, >= 1.7.7)
|
41
|
+
minitest (~> 5.1)
|
40
42
|
thread_safe (~> 0.1)
|
41
|
-
tzinfo (~>
|
42
|
-
arel (
|
43
|
-
|
44
|
-
builder (3.1.4)
|
43
|
+
tzinfo (~> 1.1)
|
44
|
+
arel (5.0.1.20140414130214)
|
45
|
+
builder (3.2.2)
|
45
46
|
erubis (2.7.0)
|
46
47
|
hike (1.2.3)
|
47
48
|
i18n (0.6.9)
|
49
|
+
json (1.8.1)
|
48
50
|
mail (2.5.4)
|
49
51
|
mime-types (~> 1.16)
|
50
52
|
treetop (~> 1.4.8)
|
51
|
-
metaclass (0.0.
|
53
|
+
metaclass (0.0.4)
|
52
54
|
mime-types (1.25.1)
|
53
|
-
minitest (
|
54
|
-
mocha (
|
55
|
+
minitest (5.3.4)
|
56
|
+
mocha (1.1.0)
|
55
57
|
metaclass (~> 0.0.1)
|
56
|
-
multi_json (1.
|
58
|
+
multi_json (1.10.1)
|
57
59
|
polyglot (0.3.4)
|
58
60
|
rack (1.5.2)
|
59
61
|
rack-test (0.6.2)
|
60
62
|
rack (>= 1.0)
|
61
|
-
rails (4.
|
62
|
-
actionmailer (= 4.
|
63
|
-
actionpack (= 4.
|
64
|
-
|
65
|
-
|
63
|
+
rails (4.1.1)
|
64
|
+
actionmailer (= 4.1.1)
|
65
|
+
actionpack (= 4.1.1)
|
66
|
+
actionview (= 4.1.1)
|
67
|
+
activemodel (= 4.1.1)
|
68
|
+
activerecord (= 4.1.1)
|
69
|
+
activesupport (= 4.1.1)
|
66
70
|
bundler (>= 1.3.0, < 2.0)
|
67
|
-
railties (= 4.
|
68
|
-
sprockets-rails (~> 2.0
|
69
|
-
railties (4.
|
70
|
-
actionpack (= 4.
|
71
|
-
activesupport (= 4.
|
71
|
+
railties (= 4.1.1)
|
72
|
+
sprockets-rails (~> 2.0)
|
73
|
+
railties (4.1.1)
|
74
|
+
actionpack (= 4.1.1)
|
75
|
+
activesupport (= 4.1.1)
|
72
76
|
rake (>= 0.8.7)
|
73
77
|
thor (>= 0.18.1, < 2.0)
|
74
|
-
rake (10.
|
75
|
-
seed-fu (2.3.
|
76
|
-
activerecord (>= 3.1, < 4.
|
77
|
-
activesupport (>= 3.1, < 4.
|
78
|
+
rake (10.3.2)
|
79
|
+
seed-fu (2.3.1)
|
80
|
+
activerecord (>= 3.1, < 4.2)
|
81
|
+
activesupport (>= 3.1, < 4.2)
|
78
82
|
seed-fu-ndo (0.0.2)
|
79
83
|
seed-fu (>= 2.2.0)
|
80
|
-
sprockets (2.
|
84
|
+
sprockets (2.12.1)
|
81
85
|
hike (~> 1.2)
|
82
86
|
multi_json (~> 1.0)
|
83
87
|
rack (~> 1.0)
|
84
88
|
tilt (~> 1.1, != 1.3.0)
|
85
|
-
sprockets-rails (2.
|
89
|
+
sprockets-rails (2.1.3)
|
86
90
|
actionpack (>= 3.0)
|
87
91
|
activesupport (>= 3.0)
|
88
92
|
sprockets (~> 2.8)
|
89
93
|
sqlite3 (1.3.9)
|
90
|
-
thor (0.
|
91
|
-
thread_safe (0.
|
92
|
-
atomic (>= 1.1.7, < 2)
|
94
|
+
thor (0.19.1)
|
95
|
+
thread_safe (0.3.3)
|
93
96
|
tilt (1.4.1)
|
94
97
|
treetop (1.4.15)
|
95
98
|
polyglot
|
96
99
|
polyglot (>= 0.3.1)
|
97
|
-
tzinfo (
|
100
|
+
tzinfo (1.2.0)
|
101
|
+
thread_safe (~> 0.1)
|
98
102
|
|
99
103
|
PLATFORMS
|
100
104
|
ruby
|
@@ -1 +1 @@
|
|
1
|
-
City.seed(:name,
|
1
|
+
City.seed(:name, name: 'Paris')
|
@@ -1,19 +1,19 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
2
|
|
3
3
|
# Maintain your wagon's version:
|
4
|
-
require
|
4
|
+
require 'dummy_superliner/version'
|
5
5
|
|
6
6
|
# Describe your gem and declare its dependencies:
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
8
|
+
s.name = 'dummy_superliner'
|
9
9
|
s.version = DummySuperliner::VERSION
|
10
|
-
s.authors = [
|
11
|
-
s.email = [
|
12
|
-
#s.homepage = "TODO"
|
13
|
-
s.summary =
|
14
|
-
s.description =
|
10
|
+
s.authors = ['Your name']
|
11
|
+
s.email = ['Your email']
|
12
|
+
# s.homepage = "TODO"
|
13
|
+
s.summary = 'Superliner'
|
14
|
+
s.description = 'Superliner description'
|
15
|
+
|
16
|
+
s.files = Dir['{app,config,db,lib}/**/*'] + ['Rakefile']
|
17
|
+
s.test_files = Dir['test/**/*']
|
15
18
|
|
16
|
-
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile"]
|
17
|
-
s.test_files = Dir["test/**/*"]
|
18
|
-
|
19
19
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module DummySuperliner
|
2
|
-
VERSION =
|
3
|
-
end
|
2
|
+
VERSION = '0.0.1'
|
3
|
+
end
|
@@ -1,16 +1,15 @@
|
|
1
1
|
module DummySuperliner
|
2
2
|
class Wagon < Rails::Engine
|
3
3
|
include Wagons::Wagon
|
4
|
-
|
4
|
+
|
5
5
|
# Add a load path for this specific Wagon
|
6
|
-
#config.autoload_paths += %W( #{config.root}/lib )
|
6
|
+
# config.autoload_paths += %W( #{config.root}/lib )
|
7
7
|
|
8
8
|
app_requirement '>= 1.0.0'
|
9
9
|
|
10
10
|
config.to_prepare do
|
11
11
|
# extend application classes here
|
12
12
|
Person.belongs_to :city
|
13
|
-
end
|
14
|
-
|
13
|
+
end
|
15
14
|
end
|
16
15
|
end
|
@@ -1,12 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CitiesControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
i_wagon = paths.index {|p| p.to_s.ends_with?('/superliner/app/views') }
|
4
|
+
test 'wagon view paths preceed application view paths' do
|
5
|
+
paths = @controller.view_paths.map { |p| p }
|
6
|
+
i_app = paths.index { |p| p.to_s.ends_with?('/dummy/app/views') }
|
7
|
+
i_wagon = paths.index { |p| p.to_s.ends_with?('/superliner/app/views') }
|
9
8
|
assert i_wagon < i_app
|
10
9
|
end
|
11
|
-
|
12
|
-
end
|
10
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PeopleControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
test "extensions are rendered with locals" do
|
4
|
+
test 'extensions are rendered with locals' do
|
6
5
|
get :index
|
7
6
|
assert_template 'index'
|
8
7
|
assert_template '_list_superliner'
|
@@ -12,5 +11,4 @@ class PeopleControllerTest < ActionController::TestCase
|
|
12
11
|
assert_match /Superliner Details/, @response.body
|
13
12
|
assert_no_match /Main Details/, @response.body
|
14
13
|
end
|
15
|
-
|
16
|
-
end
|
14
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CityTest < ActiveSupport::TestCase
|
4
|
-
test
|
4
|
+
test 'city without name is invalid' do
|
5
5
|
city = City.new
|
6
6
|
assert !city.valid?
|
7
7
|
end
|
8
|
-
|
9
|
-
test
|
8
|
+
|
9
|
+
test 'fixtures from wagon are loaded' do
|
10
10
|
assert_equal 'London', cities(:london).name
|
11
11
|
end
|
12
12
|
end
|
@@ -1,16 +1,14 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PersonTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
assert Person.where(:name => 'Pascal').exists?
|
4
|
+
test 'test seeds from application are loaded' do
|
5
|
+
assert Person.where(name: 'Pascal').exists?
|
7
6
|
end
|
8
|
-
|
9
|
-
test
|
10
|
-
person = Person.new(:
|
7
|
+
|
8
|
+
test 'person can live in a city' do
|
9
|
+
person = Person.new(name: 'Fred')
|
11
10
|
person.city = cities(:london)
|
12
11
|
assert person.save
|
13
12
|
assert cities(:london).people.include?(person)
|
14
13
|
end
|
15
|
-
|
16
14
|
end
|
@@ -4,7 +4,6 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
|
4
4
|
|
5
5
|
require File.expand_path('test/test_helper.rb', ENV['APP_ROOT'])
|
6
6
|
|
7
|
-
|
8
7
|
class ActiveSupport::TestCase
|
9
|
-
|
8
|
+
reset_fixture_path File.expand_path('../fixtures', __FILE__)
|
10
9
|
end
|
@@ -5,49 +5,48 @@ class WagonTest < ActiveSupport::TestCase
|
|
5
5
|
def setup
|
6
6
|
@wagon = Wagons.find(:superliner)
|
7
7
|
end
|
8
|
-
|
9
|
-
test
|
8
|
+
|
9
|
+
test 'all includes current wagon' do
|
10
10
|
assert Wagons.all.include?(wagon)
|
11
11
|
end
|
12
|
-
|
13
|
-
test
|
12
|
+
|
13
|
+
test 'app name is correct' do
|
14
14
|
assert_equal 'dummy', Wagons.app_name
|
15
15
|
end
|
16
|
-
|
17
|
-
test
|
16
|
+
|
17
|
+
test 'find for inexisting return nil' do
|
18
18
|
assert_nil Wagons.find(:not_existing)
|
19
19
|
end
|
20
|
-
|
21
|
-
test
|
20
|
+
|
21
|
+
test 'version can be read from gemspec' do
|
22
22
|
assert_equal Gem::Version.new('0.0.1'), wagon.version
|
23
23
|
end
|
24
|
-
|
25
|
-
test
|
24
|
+
|
25
|
+
test 'label can be read from gemspec' do
|
26
26
|
assert_equal 'Superliner', wagon.label
|
27
27
|
end
|
28
|
-
|
29
|
-
test
|
28
|
+
|
29
|
+
test 'wagon_name does not have app prefix' do
|
30
30
|
assert_equal 'superliner', wagon.wagon_name
|
31
31
|
end
|
32
|
-
|
33
|
-
test
|
32
|
+
|
33
|
+
test 'gem_name has app prefix' do
|
34
34
|
assert_equal 'dummy_superliner', wagon.gem_name
|
35
35
|
end
|
36
|
-
|
37
|
-
test
|
36
|
+
|
37
|
+
test 'description can be read from gemspec' do
|
38
38
|
assert_equal 'Superliner description', wagon.description
|
39
39
|
end
|
40
|
-
|
41
|
-
test
|
40
|
+
|
41
|
+
test 'dependencies is empty' do
|
42
42
|
assert_equal [], wagon.dependencies
|
43
43
|
end
|
44
|
-
|
45
|
-
test
|
44
|
+
|
45
|
+
test 'all_dependencies is empty' do
|
46
46
|
assert_equal [], wagon.all_dependencies
|
47
47
|
end
|
48
|
-
|
49
|
-
test
|
50
|
-
assert_equal({City => City.where(:
|
48
|
+
|
49
|
+
test 'existing seeds' do
|
50
|
+
assert_equal({ City => City.where(name: 'Paris') }, wagon.existing_seeds)
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Configure Rails Environment
|
2
|
-
ENV[
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
3
|
|
4
|
-
require File.expand_path(
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
5
|
+
require 'rails/test_help'
|
6
|
+
require 'mocha/setup'
|
7
7
|
|
8
8
|
Rails.backtrace_cleaner.remove_silencers!
|
9
9
|
|
@@ -12,5 +12,5 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
12
12
|
|
13
13
|
# Load fixtures from the engine
|
14
14
|
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
15
|
-
ActiveSupport::TestCase.fixture_path = File.expand_path(
|
15
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
|
16
16
|
end
|