Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 110 lines (104 sloc) 2.756 kb
aa7f18a Joe Ferris Bootstrap key Rails app features (root_url, ApplicationController, appli...
jferris authored
1 Feature: test a diesel engine using the bootstrapped application
2
3 Background:
4 Given a directory named "testengine"
5 When I cd to "testengine"
6 And I write to "Gemfile" with:
7 """
7247235 Prem Sichanugrist Remove specific Gem versioning, and always use latest version that Bundl...
sikachu authored
8 gem "rspec-rails", "~> 2.6.0"
9 gem "rails"
4f115e9 Prem Sichanugrist No more sqlite3-ruby
sikachu authored
10 gem "sqlite3"
aa7f18a Joe Ferris Bootstrap key Rails app features (root_url, ApplicationController, appli...
jferris authored
11 """
12 When I add this library as a dependency
13 And I write to "spec/spec_helper.rb" with:
14 """
15 ENV["RAILS_ENV"] ||= 'test'
16 require "diesel/testing"
17 require 'rspec/rails'
18 """
19 When I write to "config/routes.rb" with:
20 """
21 Rails.application.routes.draw do
22 match "/hello", :to => 'example#hello'
23 end
24 """
cb51dca Prem Sichanugrist We need to run `bundle install` here
sikachu authored
25 When I reset Bundler environment variable
26 And I run `bundle install --local`
aa7f18a Joe Ferris Bootstrap key Rails app features (root_url, ApplicationController, appli...
jferris authored
27
28 Scenario: use root_url
29 When I write to "spec/controllers/example_controller_spec.rb" with:
30 """
31 require 'spec_helper'
32 describe ExampleController do
33 it "renders hello" do
34 get :hello
35 response.should redirect_to("/")
36 end
37 end
38 """
39 When I write to "app/controllers/example_controller.rb" with:
40 """
41 class ExampleController < ActionController::Base
42 def hello
43 redirect_to root_url
44 end
45 end
46 """
e9d24b0 Prem Sichanugrist Remove Aruba's deprecated syntax
sikachu authored
47 When I run `bundle exec rspec --format documentation spec`
aa7f18a Joe Ferris Bootstrap key Rails app features (root_url, ApplicationController, appli...
jferris authored
48 Then it should pass with:
49 """
50 0 failures
51 """
52 Then at least one example should have run
53
54 Scenario: use ApplicationController
55 When I write to "spec/controllers/example_controller_spec.rb" with:
56 """
57 require 'spec_helper'
58 describe ExampleController do
59 it "renders hello" do
60 get :hello
61 response.should be_success
62 end
63 end
64 """
65 When I write to "app/controllers/example_controller.rb" with:
66 """
67 class ExampleController < ApplicationController
68 def hello
69 render :nothing => true
70 end
71 end
72 """
e9d24b0 Prem Sichanugrist Remove Aruba's deprecated syntax
sikachu authored
73 When I run `bundle exec rspec --format documentation spec`
aa7f18a Joe Ferris Bootstrap key Rails app features (root_url, ApplicationController, appli...
jferris authored
74 Then it should pass with:
75 """
76 0 failures
77 """
78 Then at least one example should have run
79
80 Scenario: use application layout
81 When I write to "spec/controllers/example_controller_spec.rb" with:
82 """
83 require 'spec_helper'
84 describe ExampleController do
85 it "renders hello" do
86 get :hello
87 response.should be_success
88 end
89 end
90 """
91 When I write to "app/controllers/example_controller.rb" with:
92 """
93 class ExampleController < ActionController::Base
94 def hello
95 render :layout => 'application'
96 end
97 end
98 """
99 When I write to "app/views/example/hello.html.erb" with:
100 """
101 hello
102 """
e9d24b0 Prem Sichanugrist Remove Aruba's deprecated syntax
sikachu authored
103 When I run `bundle exec rspec --format documentation spec`
aa7f18a Joe Ferris Bootstrap key Rails app features (root_url, ApplicationController, appli...
jferris authored
104 Then it should pass with:
105 """
106 0 failures
107 """
108 Then at least one example should have run
109
Something went wrong with that request. Please try again.