forked from thoughtbot/shoulda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted the context framework, switched to rspec
- Loading branch information
Showing
200 changed files
with
1,733 additions
and
3,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
BUNDLE_DISABLE_SHARED_GEMS: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source 'http://rubygems.org' | ||
|
||
gem 'rails', '3.0.0.beta4' | ||
gem 'sqlite3-ruby', :require => 'sqlite3' | ||
gem 'mocha' | ||
gem 'rspec-rails', '2.0.0.beta.12' | ||
gem 'ruby-debug' | ||
gem 'cucumber' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
abstract (1.0.0) | ||
actionmailer (3.0.0.beta4) | ||
actionpack (= 3.0.0.beta4) | ||
mail (~> 2.2.3) | ||
actionpack (3.0.0.beta4) | ||
activemodel (= 3.0.0.beta4) | ||
activesupport (= 3.0.0.beta4) | ||
builder (~> 2.1.2) | ||
erubis (~> 2.6.5) | ||
i18n (~> 0.4.1) | ||
rack (~> 1.1.0) | ||
rack-mount (~> 0.6.3) | ||
rack-test (~> 0.5.4) | ||
tzinfo (~> 0.3.16) | ||
activemodel (3.0.0.beta4) | ||
activesupport (= 3.0.0.beta4) | ||
builder (~> 2.1.2) | ||
i18n (~> 0.4.1) | ||
activerecord (3.0.0.beta4) | ||
activemodel (= 3.0.0.beta4) | ||
activesupport (= 3.0.0.beta4) | ||
arel (~> 0.4.0) | ||
tzinfo (~> 0.3.16) | ||
activeresource (3.0.0.beta4) | ||
activemodel (= 3.0.0.beta4) | ||
activesupport (= 3.0.0.beta4) | ||
activesupport (3.0.0.beta4) | ||
arel (0.4.0) | ||
activesupport (>= 3.0.0.beta) | ||
builder (2.1.2) | ||
columnize (0.3.1) | ||
cucumber (0.9.4) | ||
builder (~> 2.1.2) | ||
diff-lcs (~> 1.1.2) | ||
gherkin (~> 2.2.9) | ||
json (~> 1.4.6) | ||
term-ansicolor (~> 1.0.5) | ||
diff-lcs (1.1.2) | ||
erubis (2.6.6) | ||
abstract (>= 1.0.0) | ||
gherkin (2.2.9) | ||
json (~> 1.4.6) | ||
term-ansicolor (~> 1.0.5) | ||
i18n (0.4.1) | ||
json (1.4.6) | ||
linecache (0.43) | ||
mail (2.2.12) | ||
activesupport (>= 2.3.6) | ||
i18n (>= 0.4.0) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.16) | ||
mocha (0.9.10) | ||
rake | ||
nokogiri (1.4.4) | ||
polyglot (0.3.1) | ||
rack (1.1.0) | ||
rack-mount (0.6.13) | ||
rack (>= 1.0.0) | ||
rack-test (0.5.6) | ||
rack (>= 1.0) | ||
rails (3.0.0.beta4) | ||
actionmailer (= 3.0.0.beta4) | ||
actionpack (= 3.0.0.beta4) | ||
activerecord (= 3.0.0.beta4) | ||
activeresource (= 3.0.0.beta4) | ||
activesupport (= 3.0.0.beta4) | ||
bundler (>= 0.9.26) | ||
railties (= 3.0.0.beta4) | ||
railties (3.0.0.beta4) | ||
actionpack (= 3.0.0.beta4) | ||
activesupport (= 3.0.0.beta4) | ||
rake (>= 0.8.3) | ||
thor (~> 0.13.6) | ||
rake (0.8.7) | ||
rspec (2.0.0.beta.12) | ||
rspec-core (= 2.0.0.beta.12) | ||
rspec-expectations (= 2.0.0.beta.12) | ||
rspec-mocks (= 2.0.0.beta.12) | ||
rspec-core (2.0.0.beta.12) | ||
rspec-expectations (2.0.0.beta.12) | ||
diff-lcs (>= 1.1.2) | ||
rspec-mocks (2.0.0.beta.12) | ||
rspec-rails (2.0.0.beta.12) | ||
rspec (= 2.0.0.beta.12) | ||
webrat (>= 0.7.0) | ||
ruby-debug (0.10.3) | ||
columnize (>= 0.1) | ||
ruby-debug-base (~> 0.10.3.0) | ||
ruby-debug-base (0.10.3) | ||
linecache (>= 0.3) | ||
sqlite3-ruby (1.3.2) | ||
term-ansicolor (1.0.5) | ||
thor (0.13.8) | ||
treetop (1.4.9) | ||
polyglot (>= 0.3.1) | ||
tzinfo (0.3.23) | ||
webrat (0.7.2) | ||
nokogiri (>= 1.2.0) | ||
rack (>= 1.0) | ||
rack-test (>= 0.5.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
cucumber | ||
mocha | ||
rails (= 3.0.0.beta4) | ||
rspec-rails (= 2.0.0.beta.12) | ||
ruby-debug | ||
sqlite3-ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
else | ||
require 'shoulda/integrations/test_unit' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
require 'shoulda' | ||
require 'shoulda/action_controller/matchers' | ||
require 'shoulda/action_controller/assign_to_matcher' | ||
require 'shoulda/action_controller/filter_param_matcher' | ||
require 'shoulda/action_controller/set_the_flash_matcher' | ||
require 'shoulda/action_controller/render_with_layout_matcher' | ||
require 'shoulda/action_controller/respond_with_matcher' | ||
require 'shoulda/action_controller/respond_with_content_type_matcher' | ||
require 'shoulda/action_controller/set_session_matcher' | ||
require 'shoulda/action_controller/route_matcher' | ||
require 'shoulda/action_controller/redirect_to_matcher' | ||
require 'shoulda/action_controller/render_template_matcher' | ||
|
||
module Test # :nodoc: all | ||
module Unit | ||
class TestCase | ||
include Shoulda::ActionController::Matchers | ||
extend Shoulda::ActionController::Matchers | ||
end | ||
end | ||
end | ||
module Shoulda # :nodoc: | ||
module ActionController # :nodoc: | ||
|
||
if defined?(ActionController::TestCase) | ||
class ActionController::TestCase | ||
def subject | ||
@controller | ||
# By using the matchers you can quickly and easily create concise and | ||
# easy to read test suites. | ||
# | ||
# This code segment: | ||
# | ||
# describe UsersController, "on GET to show with a valid id" do | ||
# before(:each) do | ||
# get :show, :id => User.first.to_param | ||
# end | ||
# | ||
# it { should assign_to(:user) } | ||
# it { should respond_with(:success) } | ||
# it { should render_template(:show) } | ||
# it { should not_set_the_flash) } | ||
# | ||
# it "should do something else really cool" do | ||
# assigns[:user].id.should == 1 | ||
# end | ||
# end | ||
# | ||
# Would produce 5 tests for the show action | ||
module Matchers | ||
end | ||
end | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module Shoulda # :nodoc: | ||
module ActionController # :nodoc: | ||
module Matchers | ||
|
||
# Ensures that filter_parameter_logging is set for the specified key. | ||
# | ||
# Example: | ||
# | ||
# it { should filter_param(:password) } | ||
def filter_param(key) | ||
FilterParamMatcher.new(key) | ||
end | ||
|
||
class FilterParamMatcher # :nodoc: | ||
|
||
def initialize(key) | ||
@key = key.to_s | ||
end | ||
|
||
def matches?(controller) | ||
@controller = controller | ||
filters_key? | ||
end | ||
|
||
def failure_message | ||
"Expected #{@key} to be filtered; filtered keys: #{filtered_keys.join(', ')}" | ||
end | ||
|
||
def negative_failure_message | ||
"Did not expect #{@key} to be filtered" | ||
end | ||
|
||
def description | ||
"filter #{@key}" | ||
end | ||
|
||
private | ||
|
||
def filters_key? | ||
filtered_keys.include?(@key) | ||
end | ||
|
||
def filtered_keys | ||
Rails.application.config.filter_parameters.map { |filter| filter.to_s } | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.