rspec-rails-controller 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.gitignore +5 -0
  2. data/CHANGELOG.md +18 -0
  3. data/Gemfile +3 -0
  4. data/MIT-LICENSE.txt +19 -0
  5. data/README.md +90 -0
  6. data/Rakefile +11 -0
  7. data/features/controller_macro.feature +110 -0
  8. data/features/sanity.feature +32 -0
  9. data/features/steps/macro_steps.rb +32 -0
  10. data/features/support/env.rb +0 -0
  11. data/lib/rspec-rails-controller.rb +1 -0
  12. data/lib/rspec/rails/controller.rb +2 -0
  13. data/lib/rspec/rails/controller/macros.rb +62 -0
  14. data/lib/rspec/rails/controller/version.rb +7 -0
  15. data/rspec-rails-controller.gemspec +29 -0
  16. data/spec/README +1 -0
  17. data/spec/spec_helper.rb +11 -0
  18. data/spec/test_application/.gitignore +3 -0
  19. data/spec/test_application/Gemfile +4 -0
  20. data/spec/test_application/Rakefile +7 -0
  21. data/spec/test_application/app/controllers/application_controller.rb +2 -0
  22. data/spec/test_application/app/controllers/users_controller.rb +83 -0
  23. data/spec/test_application/app/models/user.rb +3 -0
  24. data/spec/test_application/app/views/layouts/application.html.erb +11 -0
  25. data/spec/test_application/app/views/users/_form.html.erb +21 -0
  26. data/spec/test_application/app/views/users/edit.html.erb +6 -0
  27. data/spec/test_application/app/views/users/index.html.erb +23 -0
  28. data/spec/test_application/app/views/users/new.html.erb +5 -0
  29. data/spec/test_application/app/views/users/show.html.erb +10 -0
  30. data/spec/test_application/config.ru +4 -0
  31. data/spec/test_application/config/application.rb +20 -0
  32. data/spec/test_application/config/boot.rb +6 -0
  33. data/spec/test_application/config/database.yml +3 -0
  34. data/spec/test_application/config/environment.rb +8 -0
  35. data/spec/test_application/config/routes.rb +3 -0
  36. data/spec/test_application/db/schema.rb +7 -0
  37. metadata +198 -0
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ log
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ ## Version 0.1.1 / 2011-03-22
2
+
3
+ * updated license and author information
4
+ * bumped version to 0.1.1
5
+
6
+ ## Version 0.0.2 / 2011-02-11
7
+
8
+ * deprecated `run_request!` in favor of `action!`
9
+ * added `action!` context blocks
10
+ * added lazy evaluation of params when passed as Proc
11
+ * added `head` and `head!` macros
12
+ * matched `README.md` examples with features
13
+ * more realistic Rails/RSpec environment for feature testing
14
+ * bumped version to 0.0.2
15
+
16
+ ## Version 0.0.1 / 2011-02-10
17
+
18
+ * initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 John Nishinaga and Pat Deegan, PhD & Associates, LLC.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # rspec-rails-controller
2
+
3
+ Lightweight controller macros for Rails 3 and RSpec.
4
+
5
+ ## Usage
6
+
7
+ The following controller spec:
8
+
9
+ get! :show, :id => 1 do
10
+ its(:response) { should be_success }
11
+ its(:response) { should render_template(:show) }
12
+ end
13
+
14
+ ...gets translated into the following stock `rspec/rails` spec:
15
+
16
+ describe 'GET #show' do
17
+ context 'action' do
18
+ before(:each) { get :show, :id => 1 }
19
+ its(:response) { should be_success }
20
+ its(:response) { should render_template(:show) }
21
+ end
22
+ end
23
+
24
+ The bang implies the before(:each) statement. If you need more control, use the non-bang version and call `action!` or use an `action!`.
25
+
26
+ post :create, :user => { :name => 'bob' } do
27
+ it { lambda { action! }.should change(User, :count).by(1) }
28
+ action! do
29
+ its(:response) { should be_redirect }
30
+ its(:response) { should redirect_to(user_path(assigns(:user))) }
31
+ end
32
+ end
33
+
34
+ Params can be a hash or a block. Blocks are evaluated when the action is fired. Params can be specified within nested describe/context blocks.
35
+
36
+ before(:all) { @user = User.create(:name => 'bob') }
37
+ put :update do
38
+ context 'with valid params' do
39
+ params { { :id => @user.id, :user => { :name => 'fred' } } }
40
+ action! do
41
+ its(:response) { should be_redirect }
42
+ its(:response) { should redirect_to(user_path(assigns(:user))) }
43
+ end
44
+ end
45
+ context 'with unknown user' do
46
+ params :id => -1
47
+ it { lambda { action! }.should raise_error(ActiveRecord::RecordNotFound) }
48
+ end
49
+ context 'with invalid params' do
50
+ params { { :id => @user.id, :user => { :name => '' } } }
51
+ action! do
52
+ its(:response) { should be_success }
53
+ its(:response) { should render_template(:edit) }
54
+ end
55
+ end
56
+ end
57
+
58
+ ## Installation
59
+
60
+ Note, this gem depends on [rspec/rails](https://github.com/rspec/rspec-rails). Make sure you follow the [installation instructions](https://github.com/rspec/rspec-rails) before you install this gem.
61
+
62
+ Add `rspec-rails-controller` to the `:test` group in the Gemfile:
63
+
64
+ group :test do
65
+ gem 'rspec-rails-controller'
66
+ end
67
+
68
+ Run the `bundle` installer:
69
+
70
+ bundle install
71
+
72
+ In your `spec/spec_helper.rb`, add the require statement below `rspec/rails`:
73
+
74
+ require 'rspec/rails'
75
+ require 'rspec/rails/controller'
76
+
77
+ In your `spec/spec_helper.rb`, add the include statement in your `RSpec.configure` block:
78
+
79
+ RSpec.configure do |config|
80
+
81
+ # ...
82
+
83
+ config.include RSpec::Rails::Controller::Macros, :type => :controller
84
+
85
+ end
86
+
87
+ ## Similar gems
88
+
89
+ * <https://github.com/sneakin/Doa>
90
+ * <https://github.com/remarkable/remarkable>
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler'
2
+ Bundler.setup
3
+ require 'cucumber/rake/task'
4
+
5
+ Bundler::GemHelper.install_tasks
6
+
7
+ Cucumber::Rake::Task.new(:features) do |t|
8
+ t.cucumber_opts = "features --format progress"
9
+ end
10
+
11
+ task :default => :features
@@ -0,0 +1,110 @@
1
+ Feature: controller macros
2
+
3
+ In order to be more efficient
4
+ As a programmer
5
+ I want cleaner controller specs
6
+
7
+ Scenario: a post request with action firing at different places
8
+ Given a simple rails application
9
+ And the following spec:
10
+ """
11
+ describe UsersController do
12
+ post :create, :user => { :name => 'bob' } do
13
+ it { lambda { action! }.should change(User, :count).by(1) }
14
+ action! do
15
+ its(:response) { should be_redirect }
16
+ its(:response) { should redirect_to(user_path(assigns(:user))) }
17
+ end
18
+ end
19
+ end
20
+ """
21
+ When I run rspec
22
+ Then the output should contain:
23
+ """
24
+ UsersController
25
+ POST #create
26
+ should change #count
27
+ action
28
+ response
29
+ should be redirect
30
+ response
31
+ should redirect to "/users/3"
32
+ """
33
+
34
+ Scenario: a put request with two different embeded params
35
+ Given a simple rails application
36
+ And the following spec:
37
+ """
38
+ describe UsersController do
39
+ before(:all) { @user = User.create(:name => 'bob') }
40
+ put :update do
41
+ context 'with valid params' do
42
+ params { { :id => @user.id, :user => { :name => 'fred' } } }
43
+ action! do
44
+ its(:response) { should be_redirect }
45
+ its(:response) { should redirect_to(user_path(assigns(:user))) }
46
+ end
47
+ end
48
+ context 'with unknown user' do
49
+ params :id => -1
50
+ it { lambda { action! }.should raise_error(ActiveRecord::RecordNotFound) }
51
+ end
52
+ context 'with invalid params' do
53
+ params { { :id => @user.id, :user => { :name => '' } } }
54
+ action! do
55
+ its(:response) { should be_success }
56
+ its(:response) { should render_template(:edit) }
57
+ end
58
+ end
59
+ end
60
+ end
61
+ """
62
+ When I run rspec
63
+ Then the output should contain:
64
+ """
65
+ UsersController
66
+ PUT #update
67
+ with valid params
68
+ action
69
+ response
70
+ should be redirect
71
+ response
72
+ should redirect to "/users/1"
73
+ with unknown user
74
+ should raise ActiveRecord::RecordNotFound
75
+ with invalid params
76
+ action
77
+ response
78
+ should be success
79
+ response
80
+ should render template :edit
81
+ """
82
+
83
+ Scenario: lazy-evaluation of params
84
+ Given a simple rails application
85
+ And the following spec:
86
+ """
87
+ describe UsersController do
88
+ get! :index, proc { { :c => 2*num } } do
89
+ context 'when num = 2' do
90
+ let(:num) { 2 }
91
+ it { request.params[:c].should == 4 }
92
+ end
93
+ context 'when num = 5' do
94
+ let(:num) { 5 }
95
+ it { request.params[:c].should == 10 }
96
+ end
97
+ end
98
+ end
99
+ """
100
+ When I run rspec
101
+ Then the output should contain:
102
+ """
103
+ UsersController
104
+ GET #index
105
+ action
106
+ when num = 2
107
+ should == 4
108
+ when num = 5
109
+ should == 10
110
+ """
@@ -0,0 +1,32 @@
1
+ Feature: sanity
2
+
3
+ In order to keep hair on my head
4
+ As a programmer
5
+ I want to make sure the working stuff works
6
+
7
+ Scenario: rspec/rails sanity test
8
+ Given a simple rails application
9
+ And the following spec:
10
+ """
11
+ describe UsersController do
12
+ before(:all) { @user = User.create(:name => 'bob') }
13
+ describe 'GET #show' do
14
+ context 'action' do
15
+ before(:each) { get :show, :id => @user.id }
16
+ its(:response) { should be_success }
17
+ its(:response) { should render_template(:show) }
18
+ end
19
+ end
20
+ end
21
+ """
22
+ When I run rspec
23
+ Then the output should contain:
24
+ """
25
+ UsersController
26
+ GET #show
27
+ action
28
+ response
29
+ should be success
30
+ response
31
+ should render template :show
32
+ """
@@ -0,0 +1,32 @@
1
+ require 'tempfile'
2
+ require 'open3'
3
+
4
+ def spec_helper_path
5
+ File.expand_path '../../../spec/spec_helper.rb', __FILE__
6
+ end
7
+
8
+ Given /^a simple rails application$/ do
9
+ @prepend = "require #{spec_helper_path.inspect}\n\n"
10
+ end
11
+
12
+ Given /^the following spec:$/ do |string|
13
+ f = Tempfile.new 'cucumber'
14
+ f.write @prepend if @prepend
15
+ # a hack to force controller type even though we're a tempfile
16
+ string.sub!(/(describe [a-zA-Z]+Controller) do$/, '\1, :type => :controller do')
17
+ f.write string
18
+ @spec_path = f.path
19
+ f.close
20
+ end
21
+
22
+ When /^I run rspec$/ do
23
+ @spec_output = nil
24
+ args = %w(bundle exec rspec -f d) + [@spec_path]
25
+ stdin, stdout, stderr = Open3.popen3 *args
26
+ @spec_output = stdout.read
27
+ $stderr.write stderr.read
28
+ end
29
+
30
+ Then /^the output should contain:$/ do |string|
31
+ @spec_output.should include(string)
32
+ end
File without changes
@@ -0,0 +1 @@
1
+ require 'rspec/rails/controller'
@@ -0,0 +1,2 @@
1
+ require 'rspec/rails/controller/macros'
2
+ require 'rspec/rails/controller/version'
@@ -0,0 +1,62 @@
1
+ module RSpec
2
+ module Rails
3
+ module Controller
4
+ module Macros
5
+
6
+ def self.included(base)
7
+ base.extend(ClassMethods)
8
+ end
9
+
10
+ module ClassMethods
11
+
12
+ def request(method, action, aparams = {}, &block)
13
+ description = "#{method.to_s.upcase} ##{action.to_s}"
14
+ describe description do
15
+ let(:params) { aparams }
16
+ define_method :action! do
17
+ p = params
18
+ p = instance_eval(&p) if p.is_a?(Proc)
19
+ send method, action, p
20
+ end
21
+ define_method(:run_request!) { action! } # deprecated
22
+ instance_eval &block
23
+ end
24
+ end
25
+
26
+ def request!(method, action, params = {}, &block)
27
+ request(method, action, params) do
28
+ action! &block
29
+ end
30
+ end
31
+
32
+ def action!(&block)
33
+ describe "action" do
34
+ before(:each) { action! }
35
+ instance_eval &block
36
+ end
37
+ end
38
+
39
+ def params(params = {}, &block)
40
+ if block
41
+ let(:params) { block }
42
+ else
43
+ let(:params) { params }
44
+ end
45
+ end
46
+
47
+ [:get, :post, :put, :delete, :head].each do |method|
48
+ module_eval <<-EOF, __FILE__, __LINE__
49
+ def #{method}(action, params = {}, &block)
50
+ request(#{method.inspect}, action, params, &block)
51
+ end
52
+ def #{method}!(action, params = {}, &block)
53
+ request!(#{method.inspect}, action, params, &block)
54
+ end
55
+ EOF
56
+ end
57
+
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ module RSpec
2
+ module Rails
3
+ module Controller
4
+ VERSION = "0.1.2"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rspec/rails/controller/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rspec-rails-controller"
7
+ s.version = RSpec::Rails::Controller::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["John Nishinaga"]
10
+ s.email = ["jingoro@casa-z.org"]
11
+ s.homepage = "https://github.com/patdeegan/rspec-rails-controller"
12
+ s.summary = "rspec-rails-controller-#{RSpec::Rails::Controller::VERSION}"
13
+ s.description = "Lightweight controller macros for Rails 3 and RSpec"
14
+
15
+ s.rubyforge_project = "rspec-rails-controller"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency 'rspec-rails', '>= 2.4.0'
23
+
24
+ s.add_development_dependency 'cucumber'
25
+ s.add_development_dependency 'cucumber-rails'
26
+ s.add_development_dependency 'activerecord'
27
+ s.add_development_dependency 'sqlite3'
28
+
29
+ end
data/spec/README ADDED
@@ -0,0 +1 @@
1
+ These files are intended to be used only by cucumber to simulate rspec.
@@ -0,0 +1,11 @@
1
+ $:.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ app_path = File.expand_path('../test_application', __FILE__)
4
+
5
+ require "#{app_path}/config/environment"
6
+ require 'rspec/rails'
7
+ require 'rspec/rails/controller'
8
+
9
+ RSpec.configure do |config|
10
+ config.include RSpec::Rails::Controller::Macros, :type => :controller
11
+ end
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ log
3
+ tmp
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'rails'
4
+ gem 'sqlite3'
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ TestApplication::Application.load_tasks
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.xml
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.xml { render :xml => @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.xml
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.xml { render :xml => @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.xml
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.xml { render :xml => @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.xml
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to(@user, :notice => 'User was successfully created.') }
48
+ format.xml { render :xml => @user, :status => :created, :location => @user }
49
+ else
50
+ format.html { render :action => "new" }
51
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.xml
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
64
+ format.xml { head :ok }
65
+ else
66
+ format.html { render :action => "edit" }
67
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.xml
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to(users_url) }
80
+ format.xml { head :ok }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ validates_presence_of :name
3
+ end
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestApplication</title>
5
+ </head>
6
+ <body>
7
+
8
+ <%= yield %>
9
+
10
+ </body>
11
+ </html>
@@ -0,0 +1,21 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="actions">
19
+ <%= f.submit %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <% @users.each do |user| %>
12
+ <tr>
13
+ <td><%= user.name %></td>
14
+ <td><%= link_to 'Show', user %></td>
15
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
16
+ <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New User', new_user_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,10 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @user.name %>
6
+ </p>
7
+
8
+
9
+ <%= link_to 'Edit', edit_user_path(@user) %> |
10
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run TestApplication::Application
@@ -0,0 +1,20 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ ENV['RAILS_ENV'] = 'test'
4
+
5
+ require 'rails/all'
6
+
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module TestApplication
10
+ class Application < Rails::Application
11
+ config.logger = nil
12
+ config.action_controller.logger = nil
13
+ config.active_record.logger = nil
14
+ config.active_support.deprecation = :stderr
15
+ config.cache_classes = true
16
+ config.consider_all_requests_local = true
17
+ config.action_controller.perform_caching = false
18
+ config.secret_token = '6f8d59aeeb8f20616856855b44dbdd53a3133e6046ff088d5db0d6a91cb5f1fd6d377b43fc8'
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: ":memory:"
@@ -0,0 +1,8 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ TestApplication::Application.initialize!
6
+
7
+ ActiveRecord::Schema.verbose = false
8
+ load(Rails.root.join('db', 'schema.rb'))
@@ -0,0 +1,3 @@
1
+ TestApplication::Application.routes.draw do
2
+ resources :users
3
+ end
@@ -0,0 +1,7 @@
1
+ ActiveRecord::Schema.define(:version => 20110211200725) do
2
+
3
+ create_table "users", :force => true do |t|
4
+ t.string "name"
5
+ end
6
+
7
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-rails-controller
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
11
+ platform: ruby
12
+ authors:
13
+ - John Nishinaga
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-22 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :runtime
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 31
30
+ segments:
31
+ - 2
32
+ - 4
33
+ - 0
34
+ version: 2.4.0
35
+ name: rspec-rails
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ type: :development
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ name: cucumber
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ prerelease: false
53
+ type: :development
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ name: cucumber-rails
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ prerelease: false
67
+ type: :development
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ name: activerecord
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ prerelease: false
81
+ type: :development
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ name: sqlite3
92
+ version_requirements: *id005
93
+ description: Lightweight controller macros for Rails 3 and RSpec
94
+ email:
95
+ - jingoro@casa-z.org
96
+ executables: []
97
+
98
+ extensions: []
99
+
100
+ extra_rdoc_files: []
101
+
102
+ files:
103
+ - .gitignore
104
+ - CHANGELOG.md
105
+ - Gemfile
106
+ - MIT-LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - features/controller_macro.feature
110
+ - features/sanity.feature
111
+ - features/steps/macro_steps.rb
112
+ - features/support/env.rb
113
+ - lib/rspec-rails-controller.rb
114
+ - lib/rspec/rails/controller.rb
115
+ - lib/rspec/rails/controller/macros.rb
116
+ - lib/rspec/rails/controller/version.rb
117
+ - rspec-rails-controller.gemspec
118
+ - spec/README
119
+ - spec/spec_helper.rb
120
+ - spec/test_application/.gitignore
121
+ - spec/test_application/Gemfile
122
+ - spec/test_application/Rakefile
123
+ - spec/test_application/app/controllers/application_controller.rb
124
+ - spec/test_application/app/controllers/users_controller.rb
125
+ - spec/test_application/app/models/user.rb
126
+ - spec/test_application/app/views/layouts/application.html.erb
127
+ - spec/test_application/app/views/users/_form.html.erb
128
+ - spec/test_application/app/views/users/edit.html.erb
129
+ - spec/test_application/app/views/users/index.html.erb
130
+ - spec/test_application/app/views/users/new.html.erb
131
+ - spec/test_application/app/views/users/show.html.erb
132
+ - spec/test_application/config.ru
133
+ - spec/test_application/config/application.rb
134
+ - spec/test_application/config/boot.rb
135
+ - spec/test_application/config/database.yml
136
+ - spec/test_application/config/environment.rb
137
+ - spec/test_application/config/routes.rb
138
+ - spec/test_application/db/schema.rb
139
+ has_rdoc: true
140
+ homepage: https://github.com/patdeegan/rspec-rails-controller
141
+ licenses: []
142
+
143
+ post_install_message:
144
+ rdoc_options: []
145
+
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ hash: 3
163
+ segments:
164
+ - 0
165
+ version: "0"
166
+ requirements: []
167
+
168
+ rubyforge_project: rspec-rails-controller
169
+ rubygems_version: 1.5.2
170
+ signing_key:
171
+ specification_version: 3
172
+ summary: rspec-rails-controller-0.1.2
173
+ test_files:
174
+ - features/controller_macro.feature
175
+ - features/sanity.feature
176
+ - features/steps/macro_steps.rb
177
+ - features/support/env.rb
178
+ - spec/README
179
+ - spec/spec_helper.rb
180
+ - spec/test_application/.gitignore
181
+ - spec/test_application/Gemfile
182
+ - spec/test_application/Rakefile
183
+ - spec/test_application/app/controllers/application_controller.rb
184
+ - spec/test_application/app/controllers/users_controller.rb
185
+ - spec/test_application/app/models/user.rb
186
+ - spec/test_application/app/views/layouts/application.html.erb
187
+ - spec/test_application/app/views/users/_form.html.erb
188
+ - spec/test_application/app/views/users/edit.html.erb
189
+ - spec/test_application/app/views/users/index.html.erb
190
+ - spec/test_application/app/views/users/new.html.erb
191
+ - spec/test_application/app/views/users/show.html.erb
192
+ - spec/test_application/config.ru
193
+ - spec/test_application/config/application.rb
194
+ - spec/test_application/config/boot.rb
195
+ - spec/test_application/config/database.yml
196
+ - spec/test_application/config/environment.rb
197
+ - spec/test_application/config/routes.rb
198
+ - spec/test_application/db/schema.rb