shoulda 3.4.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -7
- data/.hound.yml +3 -0
- data/.rubocop.yml +192 -0
- data/.ruby-version +1 -0
- data/.travis.yml +33 -2
- data/Appraisals +109 -8
- data/CHANGELOG.md +10 -0
- data/CONTRIBUTING.md +6 -1
- data/Gemfile +13 -0
- data/README.md +67 -74
- data/Rakefile +24 -10
- data/gemfiles/rails_4_2.gemfile +34 -0
- data/gemfiles/rails_4_2.gemfile.lock +240 -0
- data/gemfiles/rails_5_0.gemfile +32 -0
- data/gemfiles/rails_5_0.gemfile.lock +232 -0
- data/gemfiles/rails_5_1.gemfile +33 -0
- data/gemfiles/rails_5_1.gemfile.lock +247 -0
- data/gemfiles/rails_5_2.gemfile +35 -0
- data/gemfiles/rails_5_2.gemfile.lock +266 -0
- data/gemfiles/rails_6_0.gemfile +37 -0
- data/gemfiles/rails_6_0.gemfile.lock +291 -0
- data/lib/shoulda/version.rb +1 -1
- data/script/install_gems_in_all_appraisals +16 -0
- data/script/run_all_tests +16 -0
- data/script/supported_ruby_versions +7 -0
- data/script/update_gem_in_all_appraisals +17 -0
- data/script/update_gems_in_all_appraisals +16 -0
- data/shoulda.gemspec +23 -23
- data/test/acceptance/integrates_with_rails_test.rb +580 -0
- data/test/acceptance_test_helper.rb +43 -0
- data/test/support/acceptance/add_shoulda_to_project.rb +73 -0
- data/test/support/acceptance/helpers/array_helpers.rb +13 -0
- data/test/support/acceptance/helpers/pluralization_helpers.rb +13 -0
- data/test/support/acceptance/matchers/have_output.rb +33 -0
- data/test/support/acceptance/matchers/indicate_that_tests_were_run.rb +109 -0
- data/test/support/acceptance/rails_application_with_shoulda.rb +47 -0
- data/test/support/current_bundle.rb +61 -0
- data/test/support/snowglobe.rb +5 -0
- data/test/test_helper.rb +23 -0
- metadata +61 -153
- 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 -149
- 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/draper/Dropbox/Development/shoulda
|
3
|
-
specs:
|
4
|
-
shoulda (3.3.1)
|
5
|
-
shoulda-context (~> 1.0.1)
|
6
|
-
shoulda-matchers (~> 1.4.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://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.6)
|
49
|
-
ffi (~> 1.0, >= 1.0.6)
|
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.1.5)
|
60
|
-
gherkin (2.9.3)
|
61
|
-
json (>= 1.4.6)
|
62
|
-
i18n (0.5.0)
|
63
|
-
json (1.7.5)
|
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.19)
|
70
|
-
polyglot (0.3.3)
|
71
|
-
rack (1.2.5)
|
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 (0.9.2.2)
|
91
|
-
rdoc (3.12)
|
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.0.1)
|
107
|
-
shoulda-matchers (1.4.1)
|
108
|
-
activesupport (>= 3.0.0)
|
109
|
-
sqlite3 (1.3.6)
|
110
|
-
term-ansicolor (1.0.7)
|
111
|
-
thor (0.14.6)
|
112
|
-
treetop (1.4.11)
|
113
|
-
polyglot
|
114
|
-
polyglot (>= 0.3.1)
|
115
|
-
tzinfo (0.3.33)
|
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,149 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/draper/Dropbox/Development/shoulda
|
3
|
-
specs:
|
4
|
-
shoulda (3.3.1)
|
5
|
-
shoulda-context (~> 1.0.1)
|
6
|
-
shoulda-matchers (~> 1.4.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://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.6)
|
50
|
-
ffi (~> 1.0, >= 1.0.6)
|
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.1.5)
|
60
|
-
gherkin (2.9.3)
|
61
|
-
json (>= 1.4.6)
|
62
|
-
hike (1.2.1)
|
63
|
-
i18n (0.6.1)
|
64
|
-
jquery-rails (2.1.3)
|
65
|
-
railties (>= 3.1.0, < 5.0)
|
66
|
-
thor (~> 0.14)
|
67
|
-
json (1.7.5)
|
68
|
-
mail (2.3.3)
|
69
|
-
i18n (>= 0.4.0)
|
70
|
-
mime-types (~> 1.16)
|
71
|
-
treetop (~> 1.4.8)
|
72
|
-
mime-types (1.19)
|
73
|
-
multi_json (1.3.6)
|
74
|
-
polyglot (0.3.3)
|
75
|
-
rack (1.3.6)
|
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.2)
|
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 (0.9.2.2)
|
100
|
-
rdoc (3.12)
|
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.1)
|
116
|
-
sass-rails (3.1.6)
|
117
|
-
actionpack (~> 3.1.0)
|
118
|
-
railties (~> 3.1.0)
|
119
|
-
sass (>= 3.1.10)
|
120
|
-
tilt (~> 1.3.2)
|
121
|
-
shoulda-context (1.0.1)
|
122
|
-
shoulda-matchers (1.4.1)
|
123
|
-
activesupport (>= 3.0.0)
|
124
|
-
sprockets (2.0.4)
|
125
|
-
hike (~> 1.2)
|
126
|
-
rack (~> 1.0)
|
127
|
-
tilt (~> 1.1, != 1.3.0)
|
128
|
-
sqlite3 (1.3.6)
|
129
|
-
term-ansicolor (1.0.7)
|
130
|
-
thor (0.14.6)
|
131
|
-
tilt (1.3.3)
|
132
|
-
treetop (1.4.11)
|
133
|
-
polyglot
|
134
|
-
polyglot (>= 0.3.1)
|
135
|
-
tzinfo (0.3.33)
|
136
|
-
|
137
|
-
PLATFORMS
|
138
|
-
ruby
|
139
|
-
|
140
|
-
DEPENDENCIES
|
141
|
-
appraisal (~> 0.4.0)
|
142
|
-
aruba (~> 0.4.11)
|
143
|
-
cucumber (~> 1.1.0)
|
144
|
-
jquery-rails
|
145
|
-
rails (= 3.1.4)
|
146
|
-
rspec-rails (~> 2.7.0)
|
147
|
-
sass-rails
|
148
|
-
shoulda!
|
149
|
-
sqlite3 (~> 1.3.2)
|