shoulda 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +7 -7
- data/.hound.yml +3 -0
- data/.hound/ruby.yml +1042 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +11 -7
- data/Appraisals +13 -10
- data/CONTRIBUTING.md +6 -1
- data/Gemfile +8 -1
- data/README.md +58 -73
- data/Rakefile +21 -12
- data/gemfiles/4.2.gemfile +17 -0
- data/gemfiles/4.2.gemfile.lock +174 -0
- data/gemfiles/5.0.gemfile +17 -0
- data/gemfiles/5.0.gemfile.lock +179 -0
- data/lib/shoulda/version.rb +1 -1
- data/shoulda.gemspec +23 -23
- data/test/acceptance/rails_integration_test.rb +76 -0
- data/test/acceptance_test_helper.rb +17 -0
- data/test/report_warnings.rb +7 -0
- data/test/support/acceptance/add_shoulda_to_project.rb +78 -0
- data/test/support/acceptance/helpers.rb +19 -0
- data/test/support/acceptance/helpers/active_model_helpers.rb +11 -0
- data/test/support/acceptance/helpers/array_helpers.rb +13 -0
- data/test/support/acceptance/helpers/base_helpers.rb +14 -0
- data/test/support/acceptance/helpers/command_helpers.rb +54 -0
- data/test/support/acceptance/helpers/file_helpers.rb +19 -0
- data/test/support/acceptance/helpers/gem_helpers.rb +31 -0
- data/test/support/acceptance/helpers/pluralization_helpers.rb +13 -0
- data/test/support/acceptance/helpers/step_helpers.rb +69 -0
- data/test/support/acceptance/matchers/have_output.rb +31 -0
- data/test/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +54 -0
- data/test/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +75 -0
- data/test/support/tests/bundle.rb +94 -0
- data/test/support/tests/command_runner.rb +230 -0
- data/test/support/tests/current_bundle.rb +61 -0
- data/test/support/tests/filesystem.rb +100 -0
- data/test/support/tests/version.rb +45 -0
- data/test/test_helper.rb +18 -0
- data/test/warnings_spy.rb +62 -0
- data/test/warnings_spy/filesystem.rb +45 -0
- data/test/warnings_spy/partitioner.rb +36 -0
- data/test/warnings_spy/reader.rb +53 -0
- data/test/warnings_spy/reporter.rb +88 -0
- metadata +80 -121
- data/features/rails_integration.feature +0 -87
- data/features/step_definitions/rails_steps.rb +0 -77
- data/features/support/env.rb +0 -14
- data/gemfiles/3.0.gemfile +0 -7
- data/gemfiles/3.0.gemfile.lock +0 -127
- data/gemfiles/3.1.gemfile +0 -9
- data/gemfiles/3.1.gemfile.lock +0 -148
- data/gemfiles/3.2.gemfile +0 -9
- data/gemfiles/3.2.gemfile.lock +0 -146
@@ -1,87 +0,0 @@
|
|
1
|
-
@disable-bundler
|
2
|
-
Feature: integrate with Rails
|
3
|
-
|
4
|
-
Background:
|
5
|
-
When I generate a new rails application
|
6
|
-
And I write to "db/migrate/1_create_users.rb" with:
|
7
|
-
"""
|
8
|
-
class CreateUsers < ActiveRecord::Migration
|
9
|
-
def self.up
|
10
|
-
create_table :users do |t|
|
11
|
-
t.string :name
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
"""
|
16
|
-
When I successfully run `bundle exec rake db:migrate --trace`
|
17
|
-
And I write to "app/models/user.rb" with:
|
18
|
-
"""
|
19
|
-
class User < ActiveRecord::Base
|
20
|
-
validates_presence_of :name
|
21
|
-
end
|
22
|
-
"""
|
23
|
-
When I write to "app/controllers/examples_controller.rb" with:
|
24
|
-
"""
|
25
|
-
class ExamplesController < ApplicationController
|
26
|
-
def show
|
27
|
-
@example = 'hello'
|
28
|
-
render :nothing => true
|
29
|
-
end
|
30
|
-
end
|
31
|
-
"""
|
32
|
-
When I configure a wildcard route
|
33
|
-
|
34
|
-
Scenario: generate a rails application and use matchers in Test::Unit
|
35
|
-
When I configure the application to use shoulda
|
36
|
-
And I write to "test/unit/user_test.rb" with:
|
37
|
-
"""
|
38
|
-
require 'test_helper'
|
39
|
-
|
40
|
-
class UserTest < ActiveSupport::TestCase
|
41
|
-
should validate_presence_of(:name)
|
42
|
-
end
|
43
|
-
"""
|
44
|
-
When I write to "test/functional/examples_controller_test.rb" with:
|
45
|
-
"""
|
46
|
-
require 'test_helper'
|
47
|
-
|
48
|
-
class ExamplesControllerTest < ActionController::TestCase
|
49
|
-
def setup
|
50
|
-
get :show
|
51
|
-
end
|
52
|
-
|
53
|
-
should respond_with(:success)
|
54
|
-
should assign_to(:example)
|
55
|
-
end
|
56
|
-
"""
|
57
|
-
When I successfully run `bundle exec rake test TESTOPTS='-v' --trace`
|
58
|
-
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
|
59
|
-
And the output should contain "2 tests, 2 assertions, 0 failures, 0 errors"
|
60
|
-
And the output should contain "User should require name to be set"
|
61
|
-
And the output should contain "ExamplesController should assign @example"
|
62
|
-
|
63
|
-
Scenario: generate a rails application and use matchers in Rspec
|
64
|
-
When I configure the application to use rspec-rails
|
65
|
-
And I configure the application to use shoulda-matchers
|
66
|
-
And I run the rspec generator
|
67
|
-
And I write to "spec/models/user_spec.rb" with:
|
68
|
-
"""
|
69
|
-
require 'spec_helper'
|
70
|
-
|
71
|
-
describe User do
|
72
|
-
it { should validate_presence_of(:name) }
|
73
|
-
end
|
74
|
-
"""
|
75
|
-
When I write to "spec/controllers/examples_controller_spec.rb" with:
|
76
|
-
"""
|
77
|
-
require 'spec_helper'
|
78
|
-
|
79
|
-
describe ExamplesController, "show" do
|
80
|
-
before { get :show }
|
81
|
-
it { should assign_to(:example) }
|
82
|
-
end
|
83
|
-
"""
|
84
|
-
When I successfully run `bundle exec rake spec SPEC_OPTS=-fs --trace`
|
85
|
-
Then the output should contain "2 examples, 0 failures"
|
86
|
-
And the output should contain "should require name to be set"
|
87
|
-
And the output should contain "should assign @example"
|
@@ -1,77 +0,0 @@
|
|
1
|
-
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
|
2
|
-
APP_NAME = 'testapp'.freeze
|
3
|
-
|
4
|
-
When /^I generate a new rails application$/ do
|
5
|
-
steps %{
|
6
|
-
When I run `bundle exec rails new #{APP_NAME}`
|
7
|
-
And I cd to "#{APP_NAME}"
|
8
|
-
And I write to "Gemfile" with:
|
9
|
-
"""
|
10
|
-
source "http://rubygems.org"
|
11
|
-
gem 'rails', '3.0.12'
|
12
|
-
gem 'sqlite3'
|
13
|
-
"""
|
14
|
-
And I successfully run `bundle install --local`
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
When /^I configure the application to use "([^\"]+)" from this project$/ do |name|
|
19
|
-
append_to_gemfile "gem '#{name}', :path => '#{PROJECT_ROOT}'"
|
20
|
-
steps %{And I run `bundle install --local`}
|
21
|
-
end
|
22
|
-
|
23
|
-
When /^I run the rspec generator$/ do
|
24
|
-
steps %{
|
25
|
-
When I successfully run `rails generate rspec:install`
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
When /^I configure the application to use rspec\-rails$/ do
|
30
|
-
append_to_gemfile "gem 'rspec-rails'"
|
31
|
-
steps %{And I run `bundle install --local`}
|
32
|
-
end
|
33
|
-
|
34
|
-
When /^I configure the application to use shoulda-context$/ do
|
35
|
-
append_to_gemfile "gem 'shoulda-context'"
|
36
|
-
steps %{And I run `bundle install --local`}
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^I configure the application to use shoulda$/ do
|
40
|
-
append_to_gemfile "gem 'shoulda-matchers', '~> 1.0', :require => false"
|
41
|
-
append_to_gemfile "gem 'shoulda-context', '~> 1.0', :require => false"
|
42
|
-
append_to_gemfile "gem 'shoulda', :path => '../../..'"
|
43
|
-
steps %{And I run `bundle install --local`}
|
44
|
-
end
|
45
|
-
|
46
|
-
When /^I configure the application to use shoulda-matchers$/ do
|
47
|
-
append_to_gemfile "gem 'shoulda-matchers', '~> 1.0'"
|
48
|
-
steps %{And I run `bundle install --local`}
|
49
|
-
end
|
50
|
-
|
51
|
-
When /^I configure a wildcard route$/ do
|
52
|
-
steps %{
|
53
|
-
When I write to "config/routes.rb" with:
|
54
|
-
"""
|
55
|
-
Rails.application.routes.draw do
|
56
|
-
match ':controller(/:action(/:id(.:format)))'
|
57
|
-
end
|
58
|
-
"""
|
59
|
-
}
|
60
|
-
end
|
61
|
-
|
62
|
-
module AppendHelpers
|
63
|
-
def append_to(path, contents)
|
64
|
-
in_current_dir do
|
65
|
-
File.open(path, "a") do |file|
|
66
|
-
file.puts
|
67
|
-
file.puts contents
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def append_to_gemfile(contents)
|
73
|
-
append_to('Gemfile', contents)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
World(AppendHelpers)
|
data/features/support/env.rb
DELETED
data/gemfiles/3.0.gemfile
DELETED
data/gemfiles/3.0.gemfile.lock
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/rmcgeary/work/oss/shoulda
|
3
|
-
specs:
|
4
|
-
shoulda (3.5.0)
|
5
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
6
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
abstract (1.0.0)
|
12
|
-
actionmailer (3.0.12)
|
13
|
-
actionpack (= 3.0.12)
|
14
|
-
mail (~> 2.2.19)
|
15
|
-
actionpack (3.0.12)
|
16
|
-
activemodel (= 3.0.12)
|
17
|
-
activesupport (= 3.0.12)
|
18
|
-
builder (~> 2.1.2)
|
19
|
-
erubis (~> 2.6.6)
|
20
|
-
i18n (~> 0.5.0)
|
21
|
-
rack (~> 1.2.5)
|
22
|
-
rack-mount (~> 0.6.14)
|
23
|
-
rack-test (~> 0.5.7)
|
24
|
-
tzinfo (~> 0.3.23)
|
25
|
-
activemodel (3.0.12)
|
26
|
-
activesupport (= 3.0.12)
|
27
|
-
builder (~> 2.1.2)
|
28
|
-
i18n (~> 0.5.0)
|
29
|
-
activerecord (3.0.12)
|
30
|
-
activemodel (= 3.0.12)
|
31
|
-
activesupport (= 3.0.12)
|
32
|
-
arel (~> 2.0.10)
|
33
|
-
tzinfo (~> 0.3.23)
|
34
|
-
activeresource (3.0.12)
|
35
|
-
activemodel (= 3.0.12)
|
36
|
-
activesupport (= 3.0.12)
|
37
|
-
activesupport (3.0.12)
|
38
|
-
appraisal (0.4.1)
|
39
|
-
bundler
|
40
|
-
rake
|
41
|
-
arel (2.0.10)
|
42
|
-
aruba (0.4.11)
|
43
|
-
childprocess (>= 0.2.3)
|
44
|
-
cucumber (>= 1.1.1)
|
45
|
-
ffi (>= 1.0.11)
|
46
|
-
rspec (>= 2.7.0)
|
47
|
-
builder (2.1.2)
|
48
|
-
childprocess (0.3.9)
|
49
|
-
ffi (~> 1.0, >= 1.0.11)
|
50
|
-
cucumber (1.1.9)
|
51
|
-
builder (>= 2.1.2)
|
52
|
-
diff-lcs (>= 1.1.2)
|
53
|
-
gherkin (~> 2.9.0)
|
54
|
-
json (>= 1.4.6)
|
55
|
-
term-ansicolor (>= 1.0.6)
|
56
|
-
diff-lcs (1.1.3)
|
57
|
-
erubis (2.6.6)
|
58
|
-
abstract (>= 1.0.0)
|
59
|
-
ffi (1.8.1)
|
60
|
-
gherkin (2.9.3)
|
61
|
-
json (>= 1.4.6)
|
62
|
-
i18n (0.5.0)
|
63
|
-
json (1.7.7)
|
64
|
-
mail (2.2.19)
|
65
|
-
activesupport (>= 2.3.6)
|
66
|
-
i18n (>= 0.4.0)
|
67
|
-
mime-types (~> 1.16)
|
68
|
-
treetop (~> 1.4.8)
|
69
|
-
mime-types (1.23)
|
70
|
-
polyglot (0.3.3)
|
71
|
-
rack (1.2.8)
|
72
|
-
rack-mount (0.6.14)
|
73
|
-
rack (>= 1.0.0)
|
74
|
-
rack-test (0.5.7)
|
75
|
-
rack (>= 1.0)
|
76
|
-
rails (3.0.12)
|
77
|
-
actionmailer (= 3.0.12)
|
78
|
-
actionpack (= 3.0.12)
|
79
|
-
activerecord (= 3.0.12)
|
80
|
-
activeresource (= 3.0.12)
|
81
|
-
activesupport (= 3.0.12)
|
82
|
-
bundler (~> 1.0)
|
83
|
-
railties (= 3.0.12)
|
84
|
-
railties (3.0.12)
|
85
|
-
actionpack (= 3.0.12)
|
86
|
-
activesupport (= 3.0.12)
|
87
|
-
rake (>= 0.8.7)
|
88
|
-
rdoc (~> 3.4)
|
89
|
-
thor (~> 0.14.4)
|
90
|
-
rake (10.0.4)
|
91
|
-
rdoc (3.12.2)
|
92
|
-
json (~> 1.4)
|
93
|
-
rspec (2.7.0)
|
94
|
-
rspec-core (~> 2.7.0)
|
95
|
-
rspec-expectations (~> 2.7.0)
|
96
|
-
rspec-mocks (~> 2.7.0)
|
97
|
-
rspec-core (2.7.1)
|
98
|
-
rspec-expectations (2.7.0)
|
99
|
-
diff-lcs (~> 1.1.2)
|
100
|
-
rspec-mocks (2.7.0)
|
101
|
-
rspec-rails (2.7.0)
|
102
|
-
actionpack (~> 3.0)
|
103
|
-
activesupport (~> 3.0)
|
104
|
-
railties (~> 3.0)
|
105
|
-
rspec (~> 2.7.0)
|
106
|
-
shoulda-context (1.1.1)
|
107
|
-
shoulda-matchers (2.1.0)
|
108
|
-
activesupport (>= 3.0.0)
|
109
|
-
sqlite3 (1.3.7)
|
110
|
-
term-ansicolor (1.1.5)
|
111
|
-
thor (0.14.6)
|
112
|
-
treetop (1.4.12)
|
113
|
-
polyglot
|
114
|
-
polyglot (>= 0.3.1)
|
115
|
-
tzinfo (0.3.37)
|
116
|
-
|
117
|
-
PLATFORMS
|
118
|
-
ruby
|
119
|
-
|
120
|
-
DEPENDENCIES
|
121
|
-
appraisal (~> 0.4.0)
|
122
|
-
aruba (~> 0.4.11)
|
123
|
-
cucumber (~> 1.1.0)
|
124
|
-
rails (= 3.0.12)
|
125
|
-
rspec-rails (~> 2.7.0)
|
126
|
-
shoulda!
|
127
|
-
sqlite3 (~> 1.3.2)
|
data/gemfiles/3.1.gemfile
DELETED
data/gemfiles/3.1.gemfile.lock
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/rmcgeary/work/oss/shoulda
|
3
|
-
specs:
|
4
|
-
shoulda (3.5.0)
|
5
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
6
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionmailer (3.1.4)
|
12
|
-
actionpack (= 3.1.4)
|
13
|
-
mail (~> 2.3.0)
|
14
|
-
actionpack (3.1.4)
|
15
|
-
activemodel (= 3.1.4)
|
16
|
-
activesupport (= 3.1.4)
|
17
|
-
builder (~> 3.0.0)
|
18
|
-
erubis (~> 2.7.0)
|
19
|
-
i18n (~> 0.6)
|
20
|
-
rack (~> 1.3.6)
|
21
|
-
rack-cache (~> 1.1)
|
22
|
-
rack-mount (~> 0.8.2)
|
23
|
-
rack-test (~> 0.6.1)
|
24
|
-
sprockets (~> 2.0.3)
|
25
|
-
activemodel (3.1.4)
|
26
|
-
activesupport (= 3.1.4)
|
27
|
-
builder (~> 3.0.0)
|
28
|
-
i18n (~> 0.6)
|
29
|
-
activerecord (3.1.4)
|
30
|
-
activemodel (= 3.1.4)
|
31
|
-
activesupport (= 3.1.4)
|
32
|
-
arel (~> 2.2.3)
|
33
|
-
tzinfo (~> 0.3.29)
|
34
|
-
activeresource (3.1.4)
|
35
|
-
activemodel (= 3.1.4)
|
36
|
-
activesupport (= 3.1.4)
|
37
|
-
activesupport (3.1.4)
|
38
|
-
multi_json (~> 1.0)
|
39
|
-
appraisal (0.4.1)
|
40
|
-
bundler
|
41
|
-
rake
|
42
|
-
arel (2.2.3)
|
43
|
-
aruba (0.4.11)
|
44
|
-
childprocess (>= 0.2.3)
|
45
|
-
cucumber (>= 1.1.1)
|
46
|
-
ffi (>= 1.0.11)
|
47
|
-
rspec (>= 2.7.0)
|
48
|
-
builder (3.0.4)
|
49
|
-
childprocess (0.3.9)
|
50
|
-
ffi (~> 1.0, >= 1.0.11)
|
51
|
-
cucumber (1.1.9)
|
52
|
-
builder (>= 2.1.2)
|
53
|
-
diff-lcs (>= 1.1.2)
|
54
|
-
gherkin (~> 2.9.0)
|
55
|
-
json (>= 1.4.6)
|
56
|
-
term-ansicolor (>= 1.0.6)
|
57
|
-
diff-lcs (1.1.3)
|
58
|
-
erubis (2.7.0)
|
59
|
-
ffi (1.8.1)
|
60
|
-
gherkin (2.9.3)
|
61
|
-
json (>= 1.4.6)
|
62
|
-
hike (1.2.2)
|
63
|
-
i18n (0.6.4)
|
64
|
-
jquery-rails (2.2.1)
|
65
|
-
railties (>= 3.0, < 5.0)
|
66
|
-
thor (>= 0.14, < 2.0)
|
67
|
-
json (1.7.7)
|
68
|
-
mail (2.3.3)
|
69
|
-
i18n (>= 0.4.0)
|
70
|
-
mime-types (~> 1.16)
|
71
|
-
treetop (~> 1.4.8)
|
72
|
-
mime-types (1.23)
|
73
|
-
multi_json (1.7.3)
|
74
|
-
polyglot (0.3.3)
|
75
|
-
rack (1.3.10)
|
76
|
-
rack-cache (1.2)
|
77
|
-
rack (>= 0.4)
|
78
|
-
rack-mount (0.8.3)
|
79
|
-
rack (>= 1.0.0)
|
80
|
-
rack-ssl (1.3.3)
|
81
|
-
rack
|
82
|
-
rack-test (0.6.2)
|
83
|
-
rack (>= 1.0)
|
84
|
-
rails (3.1.4)
|
85
|
-
actionmailer (= 3.1.4)
|
86
|
-
actionpack (= 3.1.4)
|
87
|
-
activerecord (= 3.1.4)
|
88
|
-
activeresource (= 3.1.4)
|
89
|
-
activesupport (= 3.1.4)
|
90
|
-
bundler (~> 1.0)
|
91
|
-
railties (= 3.1.4)
|
92
|
-
railties (3.1.4)
|
93
|
-
actionpack (= 3.1.4)
|
94
|
-
activesupport (= 3.1.4)
|
95
|
-
rack-ssl (~> 1.3.2)
|
96
|
-
rake (>= 0.8.7)
|
97
|
-
rdoc (~> 3.4)
|
98
|
-
thor (~> 0.14.6)
|
99
|
-
rake (10.0.4)
|
100
|
-
rdoc (3.12.2)
|
101
|
-
json (~> 1.4)
|
102
|
-
rspec (2.7.0)
|
103
|
-
rspec-core (~> 2.7.0)
|
104
|
-
rspec-expectations (~> 2.7.0)
|
105
|
-
rspec-mocks (~> 2.7.0)
|
106
|
-
rspec-core (2.7.1)
|
107
|
-
rspec-expectations (2.7.0)
|
108
|
-
diff-lcs (~> 1.1.2)
|
109
|
-
rspec-mocks (2.7.0)
|
110
|
-
rspec-rails (2.7.0)
|
111
|
-
actionpack (~> 3.0)
|
112
|
-
activesupport (~> 3.0)
|
113
|
-
railties (~> 3.0)
|
114
|
-
rspec (~> 2.7.0)
|
115
|
-
sass (3.2.8)
|
116
|
-
sass-rails (3.1.0)
|
117
|
-
actionpack (~> 3.1.0)
|
118
|
-
railties (~> 3.1.0)
|
119
|
-
sass (>= 3.1.4)
|
120
|
-
shoulda-context (1.1.1)
|
121
|
-
shoulda-matchers (2.1.0)
|
122
|
-
activesupport (>= 3.0.0)
|
123
|
-
sprockets (2.0.4)
|
124
|
-
hike (~> 1.2)
|
125
|
-
rack (~> 1.0)
|
126
|
-
tilt (~> 1.1, != 1.3.0)
|
127
|
-
sqlite3 (1.3.7)
|
128
|
-
term-ansicolor (1.1.5)
|
129
|
-
thor (0.14.6)
|
130
|
-
tilt (1.4.0)
|
131
|
-
treetop (1.4.12)
|
132
|
-
polyglot
|
133
|
-
polyglot (>= 0.3.1)
|
134
|
-
tzinfo (0.3.37)
|
135
|
-
|
136
|
-
PLATFORMS
|
137
|
-
ruby
|
138
|
-
|
139
|
-
DEPENDENCIES
|
140
|
-
appraisal (~> 0.4.0)
|
141
|
-
aruba (~> 0.4.11)
|
142
|
-
cucumber (~> 1.1.0)
|
143
|
-
jquery-rails
|
144
|
-
rails (= 3.1.4)
|
145
|
-
rspec-rails (~> 2.7.0)
|
146
|
-
sass-rails
|
147
|
-
shoulda!
|
148
|
-
sqlite3 (~> 1.3.2)
|