This repository has been archived by the owner on Nov 11, 2017. It is now read-only.
/
features_generator.feature
95 lines (89 loc) · 2.61 KB
/
features_generator.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@disable-bundler
Feature: reusable features generator
Background:
Given a directory named "testengine"
When I cd to "testengine"
And I write to "testengine.gemspec" with:
"""
Gem::Specification.new do |s|
s.name = %q{testengine}
s.version = '1.0'
s.files = Dir['**/*']
s.require_path = 'lib'
s.add_dependency 'diesel'
end
"""
When I write to "app/controllers/examples_controller.rb" with:
"""
class ExamplesController < ActionController::Base
def index
render
end
end
"""
When I write to "app/views/examples/index.html.erb" with:
"""
Hello there
"""
When I write to "config/routes.rb" with:
"""
Rails.application.routes.draw do
match "/examples", :to => 'examples#index'
end
"""
When I write to "lib/testengine.rb" with:
"""
require 'rails'
module Testengine
class Engine < Rails::Engine
end
end
"""
When I write to "lib/generators/testengine/features/features_generator.rb" with:
"""
require 'diesel/generators/features_base'
module Testengine
module Generators
class FeaturesGenerator < Diesel::Generators::FeaturesBase
end
end
end
"""
When I write to "features/engine/examples.feature" with:
"""
Feature: view examples
Scenario: go to the examples page
When I go to the examples page
Then I should receive a warm greeting
"""
When I write to "features/step_definitions/engine/example_steps.rb" with:
"""
Then %{I should receive a warm greeting} do
Then %{I should see "Hello there"}
end
"""
When I cd to ".."
And I successfully run "rails new testapp"
And I cd to "testapp"
And I append to "Gemfile" with:
"""
gem "cucumber-rails", "~> 0.3.2"
gem "capybara", "~> 0.4.0"
gem "rspec", "~> 1.3.0"
"""
When I add the "testengine" as a diesel engine
And I run "bundle install --local"
And I successfully run "rails generate cucumber:install --trace"
And I successfully run "rails generate testengine:features --trace"
Scenario: copy features into an app from a diesel engine
When I run "bundle exec cucumber -r features features/testengine/examples.feature"
Then it should pass with:
"""
1 scenario (1 passed)
"""
Scenario: view generator descriptions from an app with a diesel engine
When I successfully run "rails generate testengine:features -h"
Then the output should contain:
"""
Copy cucumber feature files for the engine into your application.
"""