rails_apps_testing 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.textile +4 -0
- data/README.textile +6 -6
- data/lib/generators/testing/configure/configure_generator.rb +1 -1
- data/lib/generators/testing/configure/templates/application.rb +1 -1
- data/lib/generators/testing/configure/templates/factory_bot.rb +3 -0
- data/lib/generators/testing/configure/templates/spec/devise/factories/users.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/devise/features/users/sign_in_spec.rb +3 -3
- data/lib/generators/testing/configure/templates/spec/devise/features/users/sign_out_spec.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/devise/features/users/user_delete_spec.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb +3 -3
- data/lib/generators/testing/configure/templates/spec/devise/features/users/user_index_spec.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/devise/features/users/user_show_spec.rb +3 -3
- data/lib/generators/testing/configure/templates/spec/omniauth/factories/users.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/omniauth/models/user_spec.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/pundit/factories/users.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/pundit/features/users/user_index_spec.rb +1 -1
- data/lib/generators/testing/configure/templates/spec/pundit/policies/user_policy_spec.rb +3 -3
- data/lib/rails_apps_testing/version.rb +1 -1
- metadata +4 -4
- data/lib/generators/testing/configure/templates/factory_girl.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d603d8d040a943386f4c43e02bf36fc80bb21cdc024200cd01d7e051c94eee3c
|
4
|
+
data.tar.gz: acc8e5214358e716c8aba01810226aa93b52ce62636b5eeeaf90aeb8defa655f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebb7cb0e8c312d4901b19987551122a895c06b63e04f5699a60caf8e7ff35be9a611eee07e4fb5d2140aa8c05f66484e569c2ef2c46ac319d78ddaa9df05b3eb
|
7
|
+
data.tar.gz: 2701f59719a5a5ed84d5888d3f2c586bd1d6b8b72e7584606cc4c0f7580eb1d004a83e015b6e6928851fabfee2499e49b2d7aacd485db0fecaf6f321798c7647
|
data/CHANGELOG.textile
CHANGED
data/README.textile
CHANGED
@@ -13,7 +13,7 @@ Use this gem to set up a testing framework. The gem modifies a Rails application
|
|
13
13
|
* "RSpec Rails":https://github.com/rspec/rspec-rails – installs RSpec gems with support for Rails
|
14
14
|
* "Capybara":https://github.com/jnicklas/capybara – tests web pages
|
15
15
|
* "Database Cleaner":https://github.com/bmabey/database_cleaner – a clean slate for databases
|
16
|
-
* "
|
16
|
+
* "FactoryBot Rails":https://github.com/thoughtbot/factory_bot_rails – creates test data
|
17
17
|
* "Launchy":https://github.com/copiousfreetime/launchy – view errors in your web browser
|
18
18
|
* "Selenium Webdriver":http://docs.seleniumhq.org/projects/webdriver/ – for tests that require JavaScript
|
19
19
|
|
@@ -47,7 +47,7 @@ group :development do
|
|
47
47
|
end
|
48
48
|
group :development, :test do
|
49
49
|
gem 'rspec-rails'
|
50
|
-
gem '
|
50
|
+
gem 'factory_bot_rails'
|
51
51
|
end
|
52
52
|
group :test do
|
53
53
|
gem 'capybara'
|
@@ -128,7 +128,7 @@ config.generators do |g|
|
|
128
128
|
routing_specs: false,
|
129
129
|
controller_specs: false,
|
130
130
|
request_specs: false
|
131
|
-
g.fixture_replacement :
|
131
|
+
g.fixture_replacement :factory_bot, dir: "spec/factories"
|
132
132
|
end
|
133
133
|
</pre>
|
134
134
|
|
@@ -174,13 +174,13 @@ It will also modify *spec/rails_helper.rb*:
|
|
174
174
|
config.use_transactional_fixtures = false
|
175
175
|
</pre>
|
176
176
|
|
177
|
-
h3.
|
177
|
+
h3. FactoryBot Configuration
|
178
178
|
|
179
|
-
The generator will set up
|
179
|
+
The generator will set up FactoryBot shortcuts with a file *spec/support/factory_bot.rb*:
|
180
180
|
|
181
181
|
<pre>
|
182
182
|
RSpec.configure do |config|
|
183
|
-
config.include
|
183
|
+
config.include FactoryBot::Syntax::Methods
|
184
184
|
end
|
185
185
|
</pre>
|
186
186
|
|
@@ -24,7 +24,7 @@ module Testing
|
|
24
24
|
gsub_file 'spec/rails_helper.rb', /config.use_transactional_fixtures = true/, "config.use_transactional_fixtures = false"
|
25
25
|
gsub_file 'spec/rails_helper.rb', /# Dir/, "Dir"
|
26
26
|
copy_file 'database_cleaner.rb', 'spec/support/database_cleaner.rb'
|
27
|
-
copy_file '
|
27
|
+
copy_file 'factory_bot.rb', 'spec/support/factory_bot.rb'
|
28
28
|
when 'devise'
|
29
29
|
copy_file 'spec/devise/support/devise.rb', 'spec/support/devise.rb'
|
30
30
|
copy_file 'spec/devise/support/helpers/session_helpers.rb', 'spec/support/helpers/session_helpers.rb'
|
@@ -19,7 +19,7 @@ feature 'Sign in', :devise do
|
|
19
19
|
# When I sign in with valid credentials
|
20
20
|
# Then I see a success message
|
21
21
|
scenario 'user can sign in with valid credentials' do
|
22
|
-
user =
|
22
|
+
user = FactoryBot.create(:user)
|
23
23
|
signin(user.email, user.password)
|
24
24
|
expect(page).to have_content I18n.t 'devise.sessions.signed_in'
|
25
25
|
end
|
@@ -30,7 +30,7 @@ feature 'Sign in', :devise do
|
|
30
30
|
# When I sign in with a wrong email
|
31
31
|
# Then I see an invalid email message
|
32
32
|
scenario 'user cannot sign in with wrong email' do
|
33
|
-
user =
|
33
|
+
user = FactoryBot.create(:user)
|
34
34
|
signin('invalid@email.com', user.password)
|
35
35
|
expect(page).to have_content I18n.t 'devise.failure.not_found_in_database', authentication_keys: 'email'
|
36
36
|
end
|
@@ -41,7 +41,7 @@ feature 'Sign in', :devise do
|
|
41
41
|
# When I sign in with a wrong password
|
42
42
|
# Then I see an invalid password message
|
43
43
|
scenario 'user cannot sign in with wrong password' do
|
44
|
-
user =
|
44
|
+
user = FactoryBot.create(:user)
|
45
45
|
signin(user.email, 'invalidpass')
|
46
46
|
expect(page).to have_content I18n.t 'devise.failure.invalid', authentication_keys: 'email'
|
47
47
|
end
|
@@ -9,7 +9,7 @@ feature 'Sign out', :devise do
|
|
9
9
|
# When I sign out
|
10
10
|
# Then I see a signed out message
|
11
11
|
scenario 'user signs out successfully' do
|
12
|
-
user =
|
12
|
+
user = FactoryBot.create(:user)
|
13
13
|
signin(user.email, user.password)
|
14
14
|
expect(page).to have_content I18n.t 'devise.sessions.signed_in'
|
15
15
|
click_link 'Sign out'
|
data/lib/generators/testing/configure/templates/spec/devise/features/users/user_delete_spec.rb
CHANGED
@@ -17,7 +17,7 @@ feature 'User delete', :devise, :js do
|
|
17
17
|
# Then I should see an account deleted message
|
18
18
|
scenario 'user can delete own account' do
|
19
19
|
skip 'skip a slow test'
|
20
|
-
user =
|
20
|
+
user = FactoryBot.create(:user)
|
21
21
|
login_as(user, :scope => :user)
|
22
22
|
visit edit_user_registration_path(user)
|
23
23
|
click_button 'Cancel my account'
|
data/lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
CHANGED
@@ -16,7 +16,7 @@ feature 'User edit', :devise do
|
|
16
16
|
# When I change my email address
|
17
17
|
# Then I see an account updated message
|
18
18
|
scenario 'user changes email address' do
|
19
|
-
user =
|
19
|
+
user = FactoryBot.create(:user)
|
20
20
|
login_as(user, :scope => :user)
|
21
21
|
visit edit_user_registration_path(user)
|
22
22
|
fill_in 'Email', :with => 'newemail@example.com'
|
@@ -31,8 +31,8 @@ feature 'User edit', :devise do
|
|
31
31
|
# When I try to edit another user's profile
|
32
32
|
# Then I see my own 'edit profile' page
|
33
33
|
scenario "user cannot cannot edit another user's profile", :me do
|
34
|
-
me =
|
35
|
-
other =
|
34
|
+
me = FactoryBot.create(:user)
|
35
|
+
other = FactoryBot.create(:user, email: 'other@example.com')
|
36
36
|
login_as(me, :scope => :user)
|
37
37
|
visit edit_user_registration_path(other)
|
38
38
|
expect(page).to have_content 'Edit User'
|
data/lib/generators/testing/configure/templates/spec/devise/features/users/user_index_spec.rb
CHANGED
@@ -16,7 +16,7 @@ feature 'User index page', :devise do
|
|
16
16
|
# When I visit the user index page
|
17
17
|
# Then I see my own email address
|
18
18
|
scenario 'user sees own email address' do
|
19
|
-
user =
|
19
|
+
user = FactoryBot.create(:user)
|
20
20
|
login_as(user, scope: :user)
|
21
21
|
visit users_path
|
22
22
|
expect(page).to have_content user.email
|
data/lib/generators/testing/configure/templates/spec/devise/features/users/user_show_spec.rb
CHANGED
@@ -16,7 +16,7 @@ feature 'User profile page', :devise do
|
|
16
16
|
# When I visit the user profile page
|
17
17
|
# Then I see my own email address
|
18
18
|
scenario 'user sees own profile' do
|
19
|
-
user =
|
19
|
+
user = FactoryBot.create(:user)
|
20
20
|
login_as(user, :scope => :user)
|
21
21
|
visit user_path(user)
|
22
22
|
expect(page).to have_content 'User'
|
@@ -28,8 +28,8 @@ feature 'User profile page', :devise do
|
|
28
28
|
# When I visit another user's profile
|
29
29
|
# Then I see an 'access denied' message
|
30
30
|
scenario "user cannot see another user's profile" do
|
31
|
-
me =
|
32
|
-
other =
|
31
|
+
me = FactoryBot.create(:user)
|
32
|
+
other = FactoryBot.create(:user, email: 'other@example.com')
|
33
33
|
login_as(me, :scope => :user)
|
34
34
|
Capybara.current_session.driver.header 'Referer', root_path
|
35
35
|
visit user_path(other)
|
data/lib/generators/testing/configure/templates/spec/pundit/features/users/user_index_spec.rb
CHANGED
@@ -16,7 +16,7 @@ feature 'User index page', :devise do
|
|
16
16
|
# When I visit the user index page
|
17
17
|
# Then I see my own email address
|
18
18
|
scenario 'user sees own email address' do
|
19
|
-
user =
|
19
|
+
user = FactoryBot.create(:user, :admin)
|
20
20
|
login_as(user, scope: :user)
|
21
21
|
visit users_path
|
22
22
|
expect(page).to have_content user.email
|
@@ -1,9 +1,9 @@
|
|
1
1
|
describe UserPolicy do
|
2
2
|
subject { UserPolicy }
|
3
3
|
|
4
|
-
let (:current_user) {
|
5
|
-
let (:other_user) {
|
6
|
-
let (:admin) {
|
4
|
+
let (:current_user) { FactoryBot.build_stubbed :user }
|
5
|
+
let (:other_user) { FactoryBot.build_stubbed :user }
|
6
|
+
let (:admin) { FactoryBot.build_stubbed :user, :admin }
|
7
7
|
|
8
8
|
permissions :index? do
|
9
9
|
it "denies access if not an admin" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_apps_testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Kehoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,7 +57,7 @@ files:
|
|
57
57
|
- lib/generators/testing/configure/templates/application.rb
|
58
58
|
- lib/generators/testing/configure/templates/capybara.rb
|
59
59
|
- lib/generators/testing/configure/templates/database_cleaner.rb
|
60
|
-
- lib/generators/testing/configure/templates/
|
60
|
+
- lib/generators/testing/configure/templates/factory_bot.rb
|
61
61
|
- lib/generators/testing/configure/templates/spec/devise/factories/users.rb
|
62
62
|
- lib/generators/testing/configure/templates/spec/devise/features/users/sign_in_spec.rb
|
63
63
|
- lib/generators/testing/configure/templates/spec/devise/features/users/sign_out_spec.rb
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.7.4
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Sets up a testing framework for a Rails application.
|