rails_apps_testing 0.2.4 → 0.3.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.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.textile +5 -0
  3. data/README.textile +14 -10
  4. data/lib/generators/testing/configure/configure_generator.rb +17 -4
  5. data/lib/generators/testing/configure/templates/spec/devise/factories/users.rb +7 -0
  6. data/lib/generators/testing/configure/templates/spec/devise/features/users/sign_in_spec.rb +49 -0
  7. data/lib/generators/testing/configure/templates/spec/devise/features/users/sign_out_spec.rb +21 -0
  8. data/lib/generators/testing/configure/templates/spec/devise/features/users/user_delete_spec.rb +32 -0
  9. data/lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb +41 -0
  10. data/lib/generators/testing/configure/templates/spec/devise/features/users/user_index_spec.rb +25 -0
  11. data/lib/generators/testing/configure/templates/spec/devise/features/users/user_show_spec.rb +39 -0
  12. data/lib/generators/testing/configure/templates/spec/devise/features/visitors/sign_up_spec.rb +61 -0
  13. data/lib/generators/testing/configure/templates/{devise.rb → spec/devise/support/devise.rb} +0 -0
  14. data/lib/generators/testing/configure/templates/spec/devise/support/helpers.rb +3 -0
  15. data/lib/generators/testing/configure/templates/spec/devise/support/helpers/session_helpers.rb +18 -0
  16. data/lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb +45 -0
  17. data/lib/generators/testing/configure/templates/spec/omniauth/features/users/sign_in_spec.rb +31 -0
  18. data/lib/generators/testing/configure/templates/spec/omniauth/features/users/sign_out_spec.rb +17 -0
  19. data/lib/generators/testing/configure/templates/spec/omniauth/support/helpers.rb +5 -0
  20. data/lib/generators/testing/configure/templates/spec/omniauth/support/helpers/omniauth.rb +31 -0
  21. data/lib/rails_apps_testing/version.rb +1 -1
  22. metadata +18 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c3a18df6166437a1557963004ae0c6e3da97fec
4
- data.tar.gz: 357132f19d4edf9391de5c6320b11fad349efcdd
3
+ metadata.gz: a45babcf9e91ec332bf11ecdb5f63e59c635cdf4
4
+ data.tar.gz: 53d894e50a66f4ef042edab27d2e611432dc5c59
5
5
  SHA512:
6
- metadata.gz: 6cf291f48860bf10376e0a8f9f36a2162c5e8a9b423a67ce32319c2e5347c43d618bc06fadad4f80525071434c1474e28166f1bcea3bb6c99913ded2432b0f85
7
- data.tar.gz: cdfe5507e1b5c86fd9925012b9d5cc3ce34645f62c0c5fb19ca2c764e604741ce7191346fd2281c1e0a9932d27580e6705d1b7b4687fe82d37fae6398d53e79d
6
+ metadata.gz: 77482fbc848d257bac0d573e23b24b337401406fba4a84178084316805f1daefdc509bfa99fb03f61e1225914dfc4372959d7ee26e0b274f462eb1626259c90e
7
+ data.tar.gz: 6c301191cb4e2cdda94315187fc4f48d010d4e270cbdc23f616f6a7323bda1866e044a8d148c25dabda4335bc29bdc5908d14e187f4b90bf8b172e41422deb7d
data/CHANGELOG.textile CHANGED
@@ -1,5 +1,10 @@
1
1
  h1. CHANGELOG
2
2
 
3
+ h3. 0.3.0 June 6, 2014
4
+
5
+ * add a suite of tests for OmniAuth
6
+ * add a suite of tests for Devise
7
+
3
8
  h3. 0.2.4 June 4, 2014
4
9
 
5
10
  * for RSpec 3.0., modify '.rspec' file to include '--require rails_helper'
data/README.textile CHANGED
@@ -19,6 +19,8 @@ Use this gem to set up a testing framework. The gem modifies a Rails application
19
19
 
20
20
  This suite of gems is popular for testing Rails applications. Typically, a developer makes several small configuration changes when setting up a test framework with these gems. The configuration changes are easy to make manually, but this gem provides a generator to make the changes, for ease of use with an automated process such as an application template.
21
21
 
22
+ The gem also offers options to install test suites for Devise or OmniAuth.
23
+
22
24
  RailsApps Testing is a utility gem to use during development. You can remove it after setting up your test framework. It was originally written for use by the "Rails Composer":http://railsapps.github.io/rails-composer/ tool. Use Rails Composer to build any of the "RailApps example applications":http://railsapps.github.io/ for use as starter apps.
23
25
 
24
26
  If you like the RailsApps Testing gem, you might be interested in the "RailsLayout gem":https://github.com/RailsApps/rails_layout which generates Rails application layout files for various front-end frameworks such as Bootstrap and Foundation.
@@ -91,10 +93,11 @@ h3. RSpec Configuration
91
93
 
92
94
  The RailsApps Testing generator will remove the legacy *test/* folder if it exists (it is not needed for RSpec).
93
95
 
94
- The RailsApps Testing generator will run @rails generate rspec:install@ to create two files and a folder:
96
+ The RailsApps Testing generator will run @rails generate rspec:install@ to create three files and a folder:
95
97
 
96
98
  * *.rspec*
97
99
  * *spec/*
100
+ * *spec/spec_helper.rb*
98
101
  * *spec/rails_helper.rb*
99
102
 
100
103
  Then the RailsApps Testing generator will configure RSpec.
@@ -103,6 +106,7 @@ It will modify the file *.rspec* to add:
103
106
 
104
107
  <pre>
105
108
  --format documentation
109
+ --require rails_helper
106
110
  </pre>
107
111
 
108
112
  and will remove:
@@ -111,6 +115,8 @@ and will remove:
111
115
  --warnings
112
116
  </pre>
113
117
 
118
+ Prior to RSpec 3.0, every RSpec test file had to include @require 'spec_helper'@. With RSpec 3.0 and later versions, an additional @require 'rails_helper'@ became necessary. Fortunately, starting with RSpec 3.0, to eliminate clutter and duplication, these requirements can be specified in the project setting *.rspec* file.
119
+
114
120
  It will modify the file *config/application.rb* to suppress creation of stub files that many developers don't use:
115
121
 
116
122
  <pre>
@@ -178,24 +184,22 @@ RSpec.configure do |config|
178
184
  end
179
185
  </pre>
180
186
 
181
- h3. Devise Configuration
187
+ h3. Install Devise Tests
182
188
 
183
- If Devise in installed in your application, the generator will add a file *spec/support/devise.rb*:
189
+ If you want to install tests for Devise, you can run:
184
190
 
185
191
  <pre>
186
- RSpec.configure do |config|
187
- config.include Devise::TestHelpers, :type => :controller
188
- end
192
+ $ rails generate testing:configure devise
189
193
  </pre>
190
194
 
191
- If you want to install the file *spec/support/devise.rb* independently of the other changes, you can run:
195
+ h3. Install OmniAuth Tests
196
+
197
+ If you want to install tests for OmniAuth, you can run:
192
198
 
193
199
  <pre>
194
- $ rails generate testing:configure devise
200
+ $ rails generate testing:configure omniauth
195
201
  </pre>
196
202
 
197
- This is helpful for application templates that install RSpec before installing Devise, allowing you to run the generator again to install support for Devise after Devise is installed.
198
-
199
203
  h2. Issues
200
204
 
201
205
  Any issues? Please create an "issue":http://github.com/RailsApps/rails_apps_testing/issues on GitHub. Reporting issues (and patching!) helps everyone.
@@ -24,11 +24,24 @@ module Testing
24
24
  gsub_file 'spec/rails_helper.rb', /config.use_transactional_fixtures = true/, "config.use_transactional_fixtures = false"
25
25
  copy_file 'database_cleaner.rb', 'spec/support/database_cleaner.rb'
26
26
  copy_file 'factory_girl.rb', 'spec/support/factory_girl.rb'
27
- if File.exists?('config/initializers/devise.rb')
28
- copy_file 'devise.rb', 'spec/support/devise.rb'
29
- end
30
27
  when 'devise'
31
- copy_file 'devise.rb', 'spec/support/devise.rb'
28
+ copy_file 'spec/devise/support/devise.rb', 'spec/support/devise.rb'
29
+ copy_file 'spec/devise/support/helpers/session_helpers.rb', 'spec/support/helpers/session_helpers.rb'
30
+ copy_file 'spec/devise/support/helpers.rb', 'spec/support/helpers.rb'
31
+ copy_file 'spec/devise/factories/users.rb', 'spec/factories/users.rb'
32
+ copy_file 'spec/devise/features/users/sign_in_spec.rb', 'spec/features/users/sign_in_spec.rb'
33
+ copy_file 'spec/devise/features/users/sign_out_spec.rb', 'spec/features/users/sign_out_spec.rb'
34
+ copy_file 'spec/devise/features/users/user_delete_spec.rb', 'spec/features/users/user_delete_spec.rb'
35
+ copy_file 'spec/devise/features/users/user_edit_spec.rb', 'spec/features/users/user_edit_spec.rb'
36
+ copy_file 'spec/features/users/user_index_spec.rb', 'spec/features/users/user_index_spec.rb'
37
+ copy_file 'spec/features/users/user_show_spec.rb', 'spec/features/users/user_show_spec.rb'
38
+ copy_file 'spec/devise/features/visitors/sign_up_spec.rb', 'spec/features/visitors/sign_up_spec.rb'
39
+ when 'omniauth'
40
+ copy_file 'spec/omniauth/support/helpers/omniauth.rb', 'spec/support/helpers/omniauth.rb'
41
+ copy_file 'spec/omniauth/support/helpers.rb', 'spec/support/helpers.rb'
42
+ copy_file 'spec/omniauth/features/users/sign_in_spec.rb', 'spec/features/users/sign_in_spec.rb'
43
+ copy_file 'spec/omniauth/features/users/sign_out_spec.rb', 'spec/features/users/sign_out_spec.rb'
44
+ copy_file 'spec/omniauth/controllers/sessions_controller_spec.rb', 'spec/controllers/sessions_controller_spec.rb'
32
45
  end
33
46
  end
34
47
 
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+ factory :user do
3
+ name "Test User"
4
+ email "test@example.com"
5
+ password "please123"
6
+ end
7
+ end
@@ -0,0 +1,49 @@
1
+ # Feature: Sign in
2
+ # As a user
3
+ # I want to sign in
4
+ # So I can visit protected areas of the site
5
+ feature 'Sign in', :devise do
6
+
7
+ # Scenario: User cannot sign in if not registered
8
+ # Given I do not exist as a user
9
+ # When I sign in with valid credentials
10
+ # Then I see an invalid credentials message
11
+ scenario 'user cannot sign in if not registered' do
12
+ signin('test@example.com', 'please123')
13
+ expect(page).to have_content 'Invalid email or password.'
14
+ end
15
+
16
+ # Scenario: User can sign in with valid credentials
17
+ # Given I exist as a user
18
+ # And I am not signed in
19
+ # When I sign in with valid credentials
20
+ # Then I see a success message
21
+ scenario 'user can sign in with valid credentials' do
22
+ user = FactoryGirl.create(:user)
23
+ signin(user.email, user.password)
24
+ expect(page).to have_content 'Signed in successfully.'
25
+ end
26
+
27
+ # Scenario: User cannot sign in with wrong email
28
+ # Given I exist as a user
29
+ # And I am not signed in
30
+ # When I sign in with a wrong email
31
+ # Then I see an invalid email message
32
+ scenario 'user cannot sign in with wrong email' do
33
+ user = FactoryGirl.create(:user)
34
+ signin('invalid@email.com', user.password)
35
+ expect(page).to have_content 'Invalid email or password.'
36
+ end
37
+
38
+ # Scenario: User cannot sign in with wrong password
39
+ # Given I exist as a user
40
+ # And I am not signed in
41
+ # When I sign in with a wrong password
42
+ # Then I see an invalid password message
43
+ scenario 'user cannot sign in with wrong password' do
44
+ user = FactoryGirl.create(:user)
45
+ signin(user.email, 'invalidpass')
46
+ expect(page).to have_content 'Invalid email or password.'
47
+ end
48
+
49
+ end
@@ -0,0 +1,21 @@
1
+ # Feature: Sign out
2
+ # As a user
3
+ # I want to sign out
4
+ # So I can protect my account from unauthorized access
5
+ feature 'Sign out', :devise do
6
+
7
+ # Scenario: User signs out successfully
8
+ # Given I am signed in
9
+ # When I sign out
10
+ # Then I see a signed out message
11
+ scenario 'user signs out successfully' do
12
+ user = FactoryGirl.create(:user)
13
+ signin(user.email, user.password)
14
+ expect(page).to have_content 'Signed in successfully.'
15
+ click_link 'Sign out'
16
+ expect(page).to have_content 'Signed out successfully.'
17
+ end
18
+
19
+ end
20
+
21
+
@@ -0,0 +1,32 @@
1
+ include Warden::Test::Helpers
2
+ Warden.test_mode!
3
+
4
+ # Feature: User delete
5
+ # As a user
6
+ # I want to delete my user profile
7
+ # So I can close my account
8
+ feature 'User delete', :devise, :js do
9
+
10
+ after(:each) do
11
+ Warden.test_reset!
12
+ end
13
+
14
+ # Scenario: User can delete own account
15
+ # Given I am signed in
16
+ # When I delete my account
17
+ # Then I should see an account deleted message
18
+ scenario 'user can delete own account' do
19
+ skip 'skip a slow test'
20
+ user = FactoryGirl.create(:user)
21
+ login_as(user, :scope => :user)
22
+ visit edit_user_registration_path(user)
23
+ click_button 'Cancel my account'
24
+ page.driver.browser.switch_to.alert.accept
25
+ expect(page).to have_content 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
26
+ end
27
+
28
+ end
29
+
30
+
31
+
32
+
@@ -0,0 +1,41 @@
1
+ include Warden::Test::Helpers
2
+ Warden.test_mode!
3
+
4
+ # Feature: User edit
5
+ # As a user
6
+ # I want to edit my user profile
7
+ # So I can change my email address
8
+ feature 'User edit', :devise do
9
+
10
+ after(:each) do
11
+ Warden.test_reset!
12
+ end
13
+
14
+ # Scenario: User changes email address
15
+ # Given I am signed in
16
+ # When I change my email address
17
+ # Then I see an account updated message
18
+ scenario 'user changes email address' do
19
+ user = FactoryGirl.create(:user)
20
+ login_as(user, :scope => :user)
21
+ visit edit_user_registration_path(user)
22
+ fill_in 'Email', :with => 'newemail@example.com'
23
+ fill_in 'Current password', :with => user.password
24
+ click_button 'Update'
25
+ expect(page).to have_content 'You updated your account successfully.'
26
+ end
27
+
28
+ # Scenario: User cannot edit another user's profile
29
+ # Given I am signed in
30
+ # When I try to edit another user's profile
31
+ # Then I see my own 'edit profile' page
32
+ scenario "user cannot cannot edit another user's profile", :me do
33
+ me = FactoryGirl.create(:user)
34
+ other = FactoryGirl.create(:user, email: 'other@example.com')
35
+ login_as(me, :scope => :user)
36
+ visit edit_user_registration_path(other)
37
+ expect(page).to have_content 'Edit User'
38
+ expect(page).to have_field('Email', with: me.email)
39
+ end
40
+
41
+ end
@@ -0,0 +1,25 @@
1
+ include Warden::Test::Helpers
2
+ Warden.test_mode!
3
+
4
+ # Feature: User index page
5
+ # As a user
6
+ # I want to see a list of users
7
+ # So I can see who has registered
8
+ feature 'User index page', :devise do
9
+
10
+ after(:each) do
11
+ Warden.test_reset!
12
+ end
13
+
14
+ # Scenario: User listed on index page
15
+ # Given I am signed in
16
+ # When I visit the user index page
17
+ # Then I see my own email address
18
+ scenario 'user sees own email address' do
19
+ user = FactoryGirl.create(:user)
20
+ login_as(user, scope: :user)
21
+ visit users_path
22
+ expect(page).to have_content user.email
23
+ end
24
+
25
+ end
@@ -0,0 +1,39 @@
1
+ include Warden::Test::Helpers
2
+ Warden.test_mode!
3
+
4
+ # Feature: User profile page
5
+ # As a user
6
+ # I want to visit my user profile page
7
+ # So I can see my personal account data
8
+ feature 'User profile page', :devise do
9
+
10
+ after(:each) do
11
+ Warden.test_reset!
12
+ end
13
+
14
+ # Scenario: User sees own profile
15
+ # Given I am signed in
16
+ # When I visit the user profile page
17
+ # Then I see my own email address
18
+ scenario 'user sees own profile' do
19
+ user = FactoryGirl.create(:user)
20
+ login_as(user, :scope => :user)
21
+ visit user_path(user)
22
+ expect(page).to have_content 'User'
23
+ expect(page).to have_content user.email
24
+ end
25
+
26
+ # Scenario: User cannot see another user's profile
27
+ # Given I am signed in
28
+ # When I visit another user's profile
29
+ # Then I see an 'access denied' message
30
+ scenario "user cannot see another user's profile" do
31
+ me = FactoryGirl.create(:user)
32
+ other = FactoryGirl.create(:user, email: 'other@example.com')
33
+ login_as(me, :scope => :user)
34
+ Capybara.current_session.driver.header 'Referer', root_path
35
+ visit user_path(other)
36
+ expect(page).to have_content 'Access denied.'
37
+ end
38
+
39
+ end
@@ -0,0 +1,61 @@
1
+ # Feature: Sign up
2
+ # As a visitor
3
+ # I want to sign up
4
+ # So I can visit protected areas of the site
5
+ feature 'Sign Up', :devise do
6
+
7
+ # Scenario: Visitor can sign up with valid email address and password
8
+ # Given I am not signed in
9
+ # When I sign up with a valid email address and password
10
+ # Then I see a successful sign up message
11
+ scenario 'visitor can sign up with valid email address and password' do
12
+ sign_up_with('test@example.com', 'please123', 'please123')
13
+ expect(page).to have_content 'Welcome! You have signed up successfully.'
14
+ end
15
+
16
+ # Scenario: Visitor cannot sign up with invalid email address
17
+ # Given I am not signed in
18
+ # When I sign up with an invalid email address
19
+ # Then I see an invalid email message
20
+ scenario 'visitor cannot sign up with invalid email address' do
21
+ sign_up_with('bogus', 'please123', 'please123')
22
+ expect(page).to have_content 'Email is invalid'
23
+ end
24
+
25
+ # Scenario: Visitor cannot sign up without password
26
+ # Given I am not signed in
27
+ # When I sign up without a password
28
+ # Then I see a missing password message
29
+ scenario 'visitor cannot sign up without password' do
30
+ sign_up_with('test@example.com', '', '')
31
+ expect(page).to have_content "Password can't be blank"
32
+ end
33
+
34
+ # Scenario: Visitor cannot sign up with a short password
35
+ # Given I am not signed in
36
+ # When I sign up with a short password
37
+ # Then I see a 'too short password' message
38
+ scenario 'visitor cannot sign up with a short password' do
39
+ sign_up_with('test@example.com', 'please', 'please')
40
+ expect(page).to have_content "Password is too short"
41
+ end
42
+
43
+ # Scenario: Visitor cannot sign up without password confirmation
44
+ # Given I am not signed in
45
+ # When I sign up without a password confirmation
46
+ # Then I see a missing password confirmation message
47
+ scenario 'visitor cannot sign up without password confirmation' do
48
+ sign_up_with('test@example.com', 'please123', '')
49
+ expect(page).to have_content "Password confirmation doesn't match"
50
+ end
51
+
52
+ # Scenario: Visitor cannot sign up with mismatched password and confirmation
53
+ # Given I am not signed in
54
+ # When I sign up with a mismatched password confirmation
55
+ # Then I should see a mismatched password message
56
+ scenario 'visitor cannot sign up with mismatched password and confirmation' do
57
+ sign_up_with('test@example.com', 'please123', 'mismatch')
58
+ expect(page).to have_content "Password confirmation doesn't match"
59
+ end
60
+
61
+ end
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include Features::SessionHelpers, type: :feature
3
+ end
@@ -0,0 +1,18 @@
1
+ module Features
2
+ module SessionHelpers
3
+ def sign_up_with(email, password, confirmation)
4
+ visit new_user_registration_path
5
+ fill_in 'Email', with: email
6
+ fill_in 'Password', with: password
7
+ fill_in 'Password confirmation', :with => confirmation
8
+ click_button 'Sign up'
9
+ end
10
+
11
+ def signin(email, password)
12
+ visit new_user_session_path
13
+ fill_in 'Email', with: email
14
+ fill_in 'Password', with: password
15
+ click_button 'Sign in'
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ describe SessionsController, :omniauth do
2
+
3
+ before do
4
+ request.env['omniauth.auth'] = auth_mock
5
+ end
6
+
7
+ describe "#create" do
8
+
9
+ it "creates a user" do
10
+ expect {post :create, provider: :twitter}.to change{ User.count }.by(1)
11
+ end
12
+
13
+ it "creates a session" do
14
+ expect(session[:user_id]).to be_nil
15
+ post :create, provider: :twitter
16
+ expect(session[:user_id]).to_not be_nil
17
+ end
18
+
19
+ it "redirects the user to the user profile" do
20
+ post :create, provider: :twitter
21
+ expect(response).to redirect_to edit_user_path(1)
22
+ end
23
+
24
+ end
25
+
26
+ describe "#destroy" do
27
+
28
+ before do
29
+ post :create, provider: :twitter
30
+ end
31
+
32
+ it "resets the session" do
33
+ session[:user_id].should_not be_nil
34
+ delete :destroy
35
+ expect(session[:user_id]).to be_nil
36
+ end
37
+
38
+ it "redirects to the home page" do
39
+ delete :destroy
40
+ expect(response).to redirect_to root_url
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -0,0 +1,31 @@
1
+ # Feature: Sign in
2
+ # As a user
3
+ # I want to sign in
4
+ # So I can visit protected areas of the site
5
+ feature 'Sign in', :omniauth do
6
+
7
+ # Scenario: User can sign in with valid account
8
+ # Given I have a valid account
9
+ # And I am not signed in
10
+ # When I sign in
11
+ # Then I see a success message
12
+ scenario "user can sign in with valid account" do
13
+ signin
14
+ page.should have_content("test@example.com")
15
+ page.should have_content("Sign out")
16
+ end
17
+
18
+ # Scenario: User cannot sign in with invalid account
19
+ # Given I have no account
20
+ # And I am not signed in
21
+ # When I sign in
22
+ # Then I see an authentication error message
23
+ scenario 'user cannot sign in with invalid account' do
24
+ OmniAuth.config.mock_auth[:twitter] = :invalid_credentials
25
+ visit root_path
26
+ page.should have_content("Sign in")
27
+ click_link "Sign in"
28
+ page.should have_content('Authentication error')
29
+ end
30
+
31
+ end
@@ -0,0 +1,17 @@
1
+ # Feature: Sign out
2
+ # As a user
3
+ # I want to sign out
4
+ # So I can protect my account from unauthorized access
5
+ feature 'Sign out', :omniauth do
6
+
7
+ # Scenario: User signs out successfully
8
+ # Given I am signed in
9
+ # When I sign out
10
+ # Then I see a signed out message
11
+ scenario 'user signs out successfully' do
12
+ signin
13
+ click_link 'Sign out'
14
+ expect(page).to have_content 'Signed out'
15
+ end
16
+
17
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.include Omniauth::Mock
3
+ config.include Omniauth::SessionHelpers, type: :feature
4
+ end
5
+ OmniAuth.config.test_mode = true
@@ -0,0 +1,31 @@
1
+ module Omniauth
2
+
3
+ module Mock
4
+ def auth_mock
5
+ OmniAuth.config.mock_auth[:twitter] = {
6
+ 'provider' => 'twitter',
7
+ 'uid' => '123545',
8
+ 'user_info' => {
9
+ 'name' => 'mockuser',
10
+ 'image' => 'mock_user_thumbnail_url'
11
+ },
12
+ 'credentials' => {
13
+ 'token' => 'mock_token',
14
+ 'secret' => 'mock_secret'
15
+ }
16
+ }
17
+ end
18
+ end
19
+
20
+ module SessionHelpers
21
+ def signin
22
+ visit root_path
23
+ page.should have_content("Sign in")
24
+ click_link "Sign in"
25
+ auth_mock
26
+ fill_in 'user_email', with: 'test@example.com'
27
+ click_button "Sign in"
28
+ end
29
+ end
30
+
31
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsAppsTesting
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Kehoe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -57,8 +57,23 @@ 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/devise.rb
61
60
  - lib/generators/testing/configure/templates/factory_girl.rb
61
+ - lib/generators/testing/configure/templates/spec/devise/factories/users.rb
62
+ - lib/generators/testing/configure/templates/spec/devise/features/users/sign_in_spec.rb
63
+ - lib/generators/testing/configure/templates/spec/devise/features/users/sign_out_spec.rb
64
+ - lib/generators/testing/configure/templates/spec/devise/features/users/user_delete_spec.rb
65
+ - lib/generators/testing/configure/templates/spec/devise/features/users/user_edit_spec.rb
66
+ - lib/generators/testing/configure/templates/spec/devise/features/users/user_index_spec.rb
67
+ - lib/generators/testing/configure/templates/spec/devise/features/users/user_show_spec.rb
68
+ - lib/generators/testing/configure/templates/spec/devise/features/visitors/sign_up_spec.rb
69
+ - lib/generators/testing/configure/templates/spec/devise/support/devise.rb
70
+ - lib/generators/testing/configure/templates/spec/devise/support/helpers.rb
71
+ - lib/generators/testing/configure/templates/spec/devise/support/helpers/session_helpers.rb
72
+ - lib/generators/testing/configure/templates/spec/omniauth/controllers/sessions_controller_spec.rb
73
+ - lib/generators/testing/configure/templates/spec/omniauth/features/users/sign_in_spec.rb
74
+ - lib/generators/testing/configure/templates/spec/omniauth/features/users/sign_out_spec.rb
75
+ - lib/generators/testing/configure/templates/spec/omniauth/support/helpers.rb
76
+ - lib/generators/testing/configure/templates/spec/omniauth/support/helpers/omniauth.rb
62
77
  - lib/rails_apps_testing.rb
63
78
  - lib/rails_apps_testing/version.rb
64
79
  - rails_apps_testing.gemspec