devise-specs 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6effecf1c766dc1b0a188e9f18bdb48f8767e553
4
- data.tar.gz: feb9ba88290c49452a30ced186dee6d3b93a0ac0
3
+ metadata.gz: 21cf31ec9a840c58f26333f12a6fc1026b8143f5
4
+ data.tar.gz: dbc3396646f4aa5d55f159c184e11700495c3bb7
5
5
  SHA512:
6
- metadata.gz: c44eeab458aa434a7487a668aaa9e1ce86f475a57ef982a7e24a99a2705067b21c8adcfa014dba39a64eb6e54f9a381ec755b66a5042b3040ab5627b0d7ef928
7
- data.tar.gz: e8785b973c23cdb527d3d3713a4eccae2c0b0ad0cc34d6454ed4309b99e3bd9668753898ff2f779edba225d49fe1dcd4c350da1f5c573e92ea6895a510d45fb6
6
+ metadata.gz: b656287c6c23bf290a4e6916e086e25d10dc6d0abc2a833b13b21f91847f38c6cc1e2c6bfa3b1629725f1e53da69b2a8159f4c97c026295b5d303532ed0cec28
7
+ data.tar.gz: 834c4498b8b81a65d8413f521b20aee413626f1ffaec4c08bdffc60c7369fac940bf0975ed0903f5cd11e300aa7dae72e014ffce42758435d8a23f386b2e05b7
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/andrii/devise-specs.svg?branch=master)](https://travis-ci.org/andrii/devise-specs)
4
4
  [![Code Climate](https://codeclimate.com/github/andrii/devise-specs/badges/gpa.svg)](https://codeclimate.com/github/andrii/devise-specs)
5
5
 
6
- devise-specs is a Rails generator that adds the Devise authentication acceptance tests when you run the `devise` generator. The tests are RSpec feature specs containing Factory Girl or Fabricatoin fixture replacement methods and Capybara actions.
6
+ devise-specs is a Rails generator that adds the Devise authentication acceptance tests when you run the `devise` generator. The tests are RSpec feature specs containing Factory Girl or Fabrication fixture replacement methods and Capybara actions.
7
7
 
8
8
  Generated feature specs test the following features:
9
9
  * Registration
@@ -62,7 +62,7 @@ Add the authentication links to the layout, `user_signed_in?` should be `admin_s
62
62
  <% end %>
63
63
  ```
64
64
 
65
- Add the following lines to `config/application.rb` if you are using the Fabrication gem and gem version is less than 2.15.1:
65
+ Add the following lines to `config/application.rb` if you are using the Fabrication gem with version less than 2.15.1:
66
66
  ```ruby
67
67
  config.generators do |g|
68
68
  g.fixture_replacement :fabrication
@@ -71,7 +71,7 @@ end
71
71
 
72
72
  ## Usage
73
73
 
74
- Generate a Devise model, e.g. `User`:
74
+ Specs are created automatically when you generate a Devise model, e.g. `User`:
75
75
  ```
76
76
  $ rails generate devise User
77
77
  ...
@@ -86,6 +86,11 @@ $ rails generate devise User
86
86
  create spec/features/user_resets_password_spec.rb
87
87
  ```
88
88
 
89
+ If a Devise model is already present, run the `devise:specs` generator directly:
90
+ ```
91
+ $ rails generate devise:specs User
92
+ ```
93
+
89
94
  Run the migrations:
90
95
  ```
91
96
  $ rake db:migrate RAILS_ENV=test
@@ -104,6 +109,46 @@ Finished in 1.08 seconds (files took 2.1 seconds to load)
104
109
 
105
110
  Visit the [Relish docs](https://relishapp.com/andrii/devise-specs/docs) for all the available features and examples of the generated feature specs.
106
111
 
112
+ ## Output
113
+
114
+ `gsub spec/rails_helper.rb`
115
+
116
+ Uncomments the line that auto-requires all files in the support directory.
117
+
118
+ `insert spec/fabricators/*_fabricator.rb`
119
+
120
+ Adds `email` and `password` attributes to the fabricator.
121
+
122
+ `insert spec/factories/*.rb`
123
+
124
+ Adds `email` and `password` attributes to the factory.
125
+
126
+ `create spec/support/factory_girl.rb`
127
+
128
+ Includes `FactoryGirl::Syntax::Methods` into RSpec config to avoid prefacing Factory Girl methods with `FactoryGirl`.
129
+
130
+ `create spec/support/helpers.rb`
131
+
132
+ Includes `sign_in(resource)` helper into feature specs.
133
+
134
+ `create spec/features/*_spec.rb`
135
+
136
+ Generates a corresponding feature spec.
137
+
138
+ ## Testing
139
+
140
+ Install Ruby, development tools, Nokogiri, SQLite and JavaScript runtime system dependencies.
141
+
142
+ On Ubuntu/Mint/Debian:
143
+ ```
144
+ $ apt-get install ruby-full build-essential zlib1g-dev libsqlite3-dev nodejs
145
+ ```
146
+
147
+ Install development dependencies with `bundle install` and run the tests:
148
+ ```
149
+ $ bundle exec rake
150
+ ```
151
+
107
152
  ## License
108
153
 
109
154
  MIT License
data/devise-specs.gemspec CHANGED
@@ -1,12 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'devise-specs'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.authors = ['Andrii Ponomarov']
5
5
  s.email = 'andrii.ponomarov@gmail.com'
6
6
  s.summary = 'Generates the Devise acceptance tests.'
7
7
  s.homepage = 'https://github.com/andrii/devise-specs'
8
8
  s.license = 'MIT'
9
9
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features|fixtures)/}) }
10
+
11
+ s.required_ruby_version = '>= 2.1.0'
10
12
 
11
13
  s.add_runtime_dependency 'devise', '~> 4.1'
12
14
 
@@ -1,6 +1,6 @@
1
- module Specs
1
+ module Devise
2
2
  module Generators
3
- class DeviseGenerator < Rails::Generators::NamedBase
3
+ class SpecsGenerator < Rails::Generators::NamedBase
4
4
  ATTRIBUTES = %(
5
5
  email 'username@example.com'
6
6
  password 'password')
@@ -14,6 +14,7 @@ feature '<%= human_name %> resets a password' do
14
14
  click_button 'Send me reset password instructions'
15
15
 
16
16
  expect(page).to have_text 'You will receive an email with instructions'
17
+ expect(page).to have_current_path new_<%= singular_name %>_session_path
17
18
  end
18
19
 
19
20
  scenario '<%= singular_name %> enters an invalid email' do
@@ -39,6 +40,7 @@ feature '<%= human_name %> resets a password' do
39
40
  click_button 'Change my password'
40
41
 
41
42
  expect(page).to have_text 'Your password has been changed successfully.'
43
+ expect(page).to have_current_path root_path
42
44
  end
43
45
 
44
46
  scenario 'password reset token is invalid' do
@@ -11,6 +11,8 @@ feature '<%= human_name %> signs in' do
11
11
  sign_in <%= singular_name %>
12
12
 
13
13
  expect(page).to have_text 'Signed in successfully.'
14
+ expect(page).to have_link 'Sign Out'
15
+ expect(page).to have_current_path root_path
14
16
  end
15
17
 
16
18
  scenario 'with invalid credentials' do
@@ -23,5 +25,6 @@ feature '<%= human_name %> signs in' do
23
25
  sign_in <%= singular_name %>
24
26
 
25
27
  expect(page).to have_text 'Invalid Email or password.'
28
+ expect(page).to have_no_link 'Sign Out'
26
29
  end
27
30
  end
@@ -13,5 +13,7 @@ feature '<%= human_name %> signs out' do
13
13
  click_link 'Sign Out'
14
14
 
15
15
  expect(page).to have_text 'Signed out successfully.'
16
+ expect(page).to have_no_link 'Sign Out'
17
+ expect(page).to have_current_path root_path
16
18
  end
17
19
  end
@@ -10,6 +10,8 @@ feature '<%= human_name %> signs up' do
10
10
  click_button 'Sign up'
11
11
 
12
12
  expect(page).to have_text 'Welcome! You have signed up successfully.'
13
+ expect(page).to have_link 'Sign Out'
14
+ expect(page).to have_current_path root_path
13
15
  end
14
16
 
15
17
  scenario 'with invalid data' do
@@ -19,5 +21,6 @@ feature '<%= human_name %> signs up' do
19
21
 
20
22
  expect(page).to have_text "Email can't be blank"
21
23
  expect(page).to have_text "Password can't be blank"
24
+ expect(page).to have_no_link 'Sign Out'
22
25
  end
23
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-specs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrii Ponomarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2016-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -67,13 +67,13 @@ files:
67
67
  - devise-specs.gemspec
68
68
  - lib/devise-specs.rb
69
69
  - lib/devise/specs/railtie.rb
70
- - lib/generators/specs/devise_generator.rb
71
- - lib/generators/specs/templates/factory_girl.rb.tt
72
- - lib/generators/specs/templates/helpers.rb.tt
73
- - lib/generators/specs/templates/resource_resets_password_spec.rb.tt
74
- - lib/generators/specs/templates/resource_signs_in_spec.rb.tt
75
- - lib/generators/specs/templates/resource_signs_out_spec.rb.tt
76
- - lib/generators/specs/templates/resource_signs_up_spec.rb.tt
70
+ - lib/generators/devise/specs_generator.rb
71
+ - lib/generators/devise/templates/factory_girl.rb.tt
72
+ - lib/generators/devise/templates/helpers.rb.tt
73
+ - lib/generators/devise/templates/resource_resets_password_spec.rb.tt
74
+ - lib/generators/devise/templates/resource_signs_in_spec.rb.tt
75
+ - lib/generators/devise/templates/resource_signs_out_spec.rb.tt
76
+ - lib/generators/devise/templates/resource_signs_up_spec.rb.tt
77
77
  homepage: https://github.com/andrii/devise-specs
78
78
  licenses:
79
79
  - MIT
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 2.1.0
90
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.5.1
97
+ rubygems_version: 2.6.3
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Generates the Devise acceptance tests.