spinach-rails 0.0.6 → 0.0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +2 -2
- data/features/rails3/spinach_adds_the_route_helpers.feature +13 -0
- data/features/steps/rails3/rails_3_1_app.rb +1 -75
- data/features/steps/spinach_adds_the_route_helpers.rb +28 -0
- data/features/support/rails_fixtures.rb +80 -0
- data/lib/spinach-rails/railtie.rb +1 -1
- data/lib/spinach-rails/version.rb +1 -1
- metadata +23 -11
data/README.markdown
CHANGED
|
@@ -23,9 +23,9 @@ necessary, you can also run:
|
|
|
23
23
|
It is advised to explicitly load your environment in a file called `features/support/env.rb`,
|
|
24
24
|
so you're able to run spinach from command-line. Here's an example:
|
|
25
25
|
|
|
26
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
27
|
+
require_relative("../../config/environment")
|
|
26
28
|
require 'spinach-rails'
|
|
27
|
-
ENV['RAILS_ENV']='test'
|
|
28
|
-
require_relative '../../config/environment'
|
|
29
29
|
|
|
30
30
|
## Cleaning your database before each scenario
|
|
31
31
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Spinach adds the route helpers
|
|
2
|
+
In order to use Rails routes
|
|
3
|
+
As a developer
|
|
4
|
+
I want spinach to add my defined routes
|
|
5
|
+
|
|
6
|
+
Scenario: A constant defined in a initializer is available
|
|
7
|
+
Given I create a new rails 3 app
|
|
8
|
+
And I add spinach-rails to it
|
|
9
|
+
And I add an initilizer that defines a constant
|
|
10
|
+
And I add a test to assert if the constant is defined
|
|
11
|
+
And I add an environment file that load rails
|
|
12
|
+
When I run spinach
|
|
13
|
+
Then the features should pass
|
|
@@ -3,39 +3,13 @@ require 'aruba/api'
|
|
|
3
3
|
class SpinachRails3_1 < Spinach::FeatureSteps
|
|
4
4
|
|
|
5
5
|
feature 'Spinach works with a Rails 3.1 app'
|
|
6
|
-
|
|
6
|
+
include RailsFixtures
|
|
7
7
|
include Aruba::Api
|
|
8
8
|
|
|
9
|
-
Given "I create a new rails 3 app" do
|
|
10
|
-
create_rails_app('3.1')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
And "I add spinach-rails to it" do
|
|
14
|
-
add_spinach_rails
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
And "I add some test features" do
|
|
18
|
-
add_test_features
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
When "I run spinach" do
|
|
22
|
-
run "spinach"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
Then "the features should pass" do
|
|
26
|
-
stop_processes!
|
|
27
|
-
last_exit_status.must_equal 0
|
|
28
|
-
end
|
|
29
|
-
|
|
30
9
|
When 'I run the spinach rake task' do
|
|
31
10
|
run "rake spinach"
|
|
32
11
|
end
|
|
33
12
|
|
|
34
|
-
And "I add an environment file that load rails" do
|
|
35
|
-
write_file('features/support/env.rb',
|
|
36
|
-
"require_relative '../../config/environment'")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
13
|
And 'I add a test feature file without a steps file' do
|
|
40
14
|
write_file('features/test_feature.feature',
|
|
41
15
|
"Feature: Test feature
|
|
@@ -55,52 +29,4 @@ class SpinachRails3_1 < Spinach::FeatureSteps
|
|
|
55
29
|
File.exists?('features/steps/test_feature.rb').must_equal true
|
|
56
30
|
end
|
|
57
31
|
end
|
|
58
|
-
|
|
59
|
-
private
|
|
60
|
-
|
|
61
|
-
def create_rails_app(version = '3.1')
|
|
62
|
-
@aruba_timeout_seconds = 100
|
|
63
|
-
write_file(
|
|
64
|
-
'Gemfile',
|
|
65
|
-
" source :rubygems
|
|
66
|
-
gem 'rails', '#{version}'
|
|
67
|
-
")
|
|
68
|
-
run "bundle install"
|
|
69
|
-
run "rm -fR rails_app"
|
|
70
|
-
stop_processes!
|
|
71
|
-
run 'bundle exec rails new rails_app'
|
|
72
|
-
stop_processes!
|
|
73
|
-
cd "rails_app"
|
|
74
|
-
write_file('config/routes.rb', "
|
|
75
|
-
RailsApp::Application.routes.draw do
|
|
76
|
-
root to: redirect('/index.html')
|
|
77
|
-
end
|
|
78
|
-
")
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def add_spinach_rails
|
|
82
|
-
append_to_file("Gemfile",
|
|
83
|
-
"gem 'spinach-rails', group: :test, path: '#{Dir.pwd}'")
|
|
84
|
-
run "bundle install"
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def add_test_features
|
|
88
|
-
write_file('features/test_feature.feature',
|
|
89
|
-
"Feature: Test feature
|
|
90
|
-
Scenario: Test scenario
|
|
91
|
-
Given I am running spinach
|
|
92
|
-
Then It should be all OK
|
|
93
|
-
")
|
|
94
|
-
write_file('features/steps/test_feature.rb',
|
|
95
|
-
"class TestFeature < Spinach::FeatureSteps
|
|
96
|
-
Given 'I am running spinach' do
|
|
97
|
-
visit root_path
|
|
98
|
-
end
|
|
99
|
-
Then 'It should be all OK' do
|
|
100
|
-
page.has_content?('Rails').must_equal true
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
")
|
|
104
|
-
end
|
|
105
|
-
|
|
106
32
|
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class SpinachAddsTheRouteHelpers < Spinach::FeatureSteps
|
|
2
|
+
include RailsFixtures
|
|
3
|
+
|
|
4
|
+
And 'I add an initilizer that defines a constant' do
|
|
5
|
+
write_file('config/initializers/yay.rb', 'MYCONST = 10')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
And 'I add a test to assert if the constant is defined' do
|
|
9
|
+
write_file('features/test_constant.feature',
|
|
10
|
+
"Feature: Test constant
|
|
11
|
+
Scenario: Test constant
|
|
12
|
+
Given I am running spinach
|
|
13
|
+
Then the constant should be defined
|
|
14
|
+
")
|
|
15
|
+
|
|
16
|
+
write_file('features/steps/test_constant.rb',
|
|
17
|
+
"class TestConstant < Spinach::FeatureSteps
|
|
18
|
+
Given 'I am running spinach' do
|
|
19
|
+
visit root_path
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
Then 'the constant should be defined' do
|
|
23
|
+
MYCONST.must_equal 10
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
require 'aruba/api'
|
|
2
|
+
|
|
3
|
+
module RailsFixtures
|
|
4
|
+
include Spinach::DSL
|
|
5
|
+
include Aruba::Api
|
|
6
|
+
|
|
7
|
+
Given "I create a new rails 3 app" do
|
|
8
|
+
create_rails_app('3.1')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
And "I add spinach-rails to it" do
|
|
12
|
+
add_spinach_rails
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
And "I add some test features" do
|
|
16
|
+
add_test_features
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
When "I run spinach" do
|
|
20
|
+
run "spinach"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
Then "the features should pass" do
|
|
24
|
+
stop_processes!
|
|
25
|
+
last_exit_status.must_equal 0
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
And "I add an environment file that load rails" do
|
|
29
|
+
write_file('features/support/env.rb',
|
|
30
|
+
"require_relative '../../config/environment'")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def create_rails_app(version = '3.1')
|
|
36
|
+
@aruba_timeout_seconds = 100
|
|
37
|
+
write_file(
|
|
38
|
+
'Gemfile',
|
|
39
|
+
" source :rubygems
|
|
40
|
+
gem 'rails', '#{version}'
|
|
41
|
+
")
|
|
42
|
+
run "bundle install"
|
|
43
|
+
run "rm -fR rails_app"
|
|
44
|
+
stop_processes!
|
|
45
|
+
run 'bundle exec rails new rails_app'
|
|
46
|
+
stop_processes!
|
|
47
|
+
cd "rails_app"
|
|
48
|
+
write_file('config/routes.rb', "
|
|
49
|
+
RailsApp::Application.routes.draw do
|
|
50
|
+
root to: redirect('/index.html')
|
|
51
|
+
end
|
|
52
|
+
")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def add_spinach_rails
|
|
56
|
+
append_to_file("Gemfile",
|
|
57
|
+
"gem 'spinach-rails', group: :test, path: '#{Dir.pwd}'")
|
|
58
|
+
run "bundle install"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def add_test_features
|
|
62
|
+
write_file('features/test_feature.feature',
|
|
63
|
+
"Feature: Test feature
|
|
64
|
+
Scenario: Test scenario
|
|
65
|
+
Given I am running spinach
|
|
66
|
+
Then It should be all OK
|
|
67
|
+
")
|
|
68
|
+
write_file('features/steps/test_feature.rb',
|
|
69
|
+
"class TestFeature < Spinach::FeatureSteps
|
|
70
|
+
Given 'I am running spinach' do
|
|
71
|
+
visit root_path
|
|
72
|
+
end
|
|
73
|
+
Then 'It should be all OK' do
|
|
74
|
+
page.has_content?('Rails').must_equal true
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
")
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
@@ -8,7 +8,7 @@ module Spinach
|
|
|
8
8
|
File.dirname(__FILE__), '..', '..', 'tasks/spinach.rake')
|
|
9
9
|
)
|
|
10
10
|
end
|
|
11
|
-
initializer "add_routes", after: :
|
|
11
|
+
initializer "add_routes", after: :after_initialize do |app|
|
|
12
12
|
routes = app.routes.url_helpers
|
|
13
13
|
Spinach::FeatureSteps.send(:include, routes)
|
|
14
14
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spinach-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.6
|
|
4
|
+
version: 0.0.6.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2011-10-
|
|
12
|
+
date: 2011-10-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: capybara
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &2168639020 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *2168639020
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: spinach
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &2168636840 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: 0.1.5.2
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *2168636840
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rails
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &2168635480 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ! '>='
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: '3'
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *2168635480
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: aruba
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &2168634560 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
@@ -54,7 +54,7 @@ dependencies:
|
|
|
54
54
|
version: '0'
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *2168634560
|
|
58
58
|
description: spinach-rails adds Rails support to spinach
|
|
59
59
|
email:
|
|
60
60
|
- info@codegram.com
|
|
@@ -69,8 +69,11 @@ files:
|
|
|
69
69
|
- README.markdown
|
|
70
70
|
- Rakefile
|
|
71
71
|
- features/rails3/rails_3_1_app.feature
|
|
72
|
+
- features/rails3/spinach_adds_the_route_helpers.feature
|
|
72
73
|
- features/steps/rails3/rails_3_1_app.rb
|
|
74
|
+
- features/steps/spinach_adds_the_route_helpers.rb
|
|
73
75
|
- features/support/env.rb
|
|
76
|
+
- features/support/rails_fixtures.rb
|
|
74
77
|
- lib/spinach-rails.rb
|
|
75
78
|
- lib/spinach-rails/railtie.rb
|
|
76
79
|
- lib/spinach-rails/version.rb
|
|
@@ -88,20 +91,29 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
88
91
|
- - ! '>='
|
|
89
92
|
- !ruby/object:Gem::Version
|
|
90
93
|
version: '0'
|
|
94
|
+
segments:
|
|
95
|
+
- 0
|
|
96
|
+
hash: 2903019735473252932
|
|
91
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
98
|
none: false
|
|
93
99
|
requirements:
|
|
94
100
|
- - ! '>='
|
|
95
101
|
- !ruby/object:Gem::Version
|
|
96
102
|
version: '0'
|
|
103
|
+
segments:
|
|
104
|
+
- 0
|
|
105
|
+
hash: 2903019735473252932
|
|
97
106
|
requirements: []
|
|
98
107
|
rubyforge_project:
|
|
99
|
-
rubygems_version: 1.8.
|
|
108
|
+
rubygems_version: 1.8.10
|
|
100
109
|
signing_key:
|
|
101
110
|
specification_version: 3
|
|
102
111
|
summary: spinach-rails adds Rails support to spinach
|
|
103
112
|
test_files:
|
|
104
113
|
- features/rails3/rails_3_1_app.feature
|
|
114
|
+
- features/rails3/spinach_adds_the_route_helpers.feature
|
|
105
115
|
- features/steps/rails3/rails_3_1_app.rb
|
|
116
|
+
- features/steps/spinach_adds_the_route_helpers.rb
|
|
106
117
|
- features/support/env.rb
|
|
118
|
+
- features/support/rails_fixtures.rb
|
|
107
119
|
has_rdoc:
|