devise-specs 0.0.4 → 0.0.5

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
- SHA1:
3
- metadata.gz: 4bed81def6e8215569da1d3e31d246cc5880d801
4
- data.tar.gz: eb2db6c8e69595eb26ce62d2be1918f09ac3fb34
2
+ SHA256:
3
+ metadata.gz: be3f6fffcdfd6745c53813e98dff18e028631f927693c9632a81366d2d5ef8f0
4
+ data.tar.gz: 7134709344aab0354ac0d041d7222fc808674cfda488791ee9edf8f7c9b0adc2
5
5
  SHA512:
6
- metadata.gz: 8043e3e182f0e3e999ccfb2ee85f375b8aa2576ab28210212317099ba66512e654adeef0faa0c058d1446f89c5be04b63618d1a65272643291c7e64a9809d8da
7
- data.tar.gz: c47c69aa64ad0da00f5f8385a2417d98343ccc48539e8c25008b93a9327535be9b1a610cd5cc702bec46cd66ab7dc452642982d28691f8287ecea03ee63db04f
6
+ metadata.gz: d2c8a1bf622e860236e2a6e7a61e22d6e0574833d83d8ed407c89d3038af38cf63861395444677ffadefd790fc2e6eec7cf2bb93722b24329cb5be74c3ca7c71
7
+ data.tar.gz: 928a9d44fe9db4918a0631cdde7eaed7ee98893ea471f0a6ad9a96c2440a89d089ab02a61102edc3276799e7c8d0a66111998320ea72f6b99d76a470dd1acefa
@@ -0,0 +1,26 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version: ['2.6', '2.7']
16
+
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ - name: Bundle install
24
+ run: bundle install
25
+ - name: Run tests
26
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.5
2
+
3
+ * Support latest Factory Bot and RSpec Rails versions
4
+
1
5
  ### 0.0.4
2
6
 
3
7
  * Make internal tests pass on Rails 5.1 and clean up docs
data/README.md CHANGED
@@ -1,9 +1,6 @@
1
- # devise-specs
1
+ # devise-specs [![Build Status][ci-image]][ci] [![Maintainability][grade-image]][grade]
2
2
 
3
- [![Build Status](https://travis-ci.org/andrii/devise-specs.svg?branch=master)](https://travis-ci.org/andrii/devise-specs)
4
- [![Code Climate](https://codeclimate.com/github/andrii/devise-specs/badges/gpa.svg)](https://codeclimate.com/github/andrii/devise-specs)
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 Fabrication fixture replacement methods and Capybara actions.
3
+ 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 Bot or Fabrication fixture replacement methods and Capybara actions.
7
4
 
8
5
  Generated feature specs test the following features:
9
6
  * Registration
@@ -11,11 +8,9 @@ Generated feature specs test the following features:
11
8
  * Logout
12
9
  * Password reset
13
10
 
14
- Works with Rails 4 and 5.
15
-
16
11
  ## Installation
17
12
 
18
- Make sure `devise-specs`, `devise`, `rspec-rails`, `capybara` and fixture replacement gems are added to the `Gemfile`:
13
+ Make sure `devise`, `devise-specs`, `rspec-rails`, `capybara` and fixture replacement gems are added to the `Gemfile`:
19
14
  ```ruby
20
15
  gem 'devise'
21
16
 
@@ -24,12 +19,12 @@ group :development do
24
19
  end
25
20
 
26
21
  group :test do
27
- gem 'capybara' # already present in Rails 5.1 Gemfile
22
+ gem 'capybara'
28
23
  end
29
24
 
30
25
  group :development, :test do
31
26
  gem 'rspec-rails'
32
- gem 'factory_girl_rails' # or: gem 'fabrication'
27
+ gem 'factory_bot_rails' # or: gem 'fabrication'
33
28
  end
34
29
  ```
35
30
 
@@ -39,12 +34,12 @@ and then run `bundle install`.
39
34
 
40
35
  Generate the RSpec configuratoin files:
41
36
  ```
42
- $ rails generate rspec:install
37
+ $ bin/rails generate rspec:install
43
38
  ```
44
39
 
45
40
  Generate the Devise configuration files and follow the setup instructions to define the default url options, root route and flash messages:
46
41
  ```
47
- $ rails generate devise:install
42
+ $ bin/rails generate devise:install
48
43
  ```
49
44
 
50
45
  Configure the Action Mailer URL options for the test environment using the following line in `config/environments/test.rb`:
@@ -66,12 +61,12 @@ Add the authentication links to the layout, `user_signed_in?` should be `admin_s
66
61
 
67
62
  Specs are created automatically when you generate a Devise model, e.g. `User`:
68
63
  ```
69
- $ rails generate devise User
64
+ $ bin/rails generate devise User
70
65
  ...
71
66
  invoke specs
72
67
  gsub spec/rails_helper.rb
73
68
  insert spec/factories/users.rb
74
- create spec/support/factory_girl.rb
69
+ create spec/support/factory_bot.rb
75
70
  create spec/support/devise.rb
76
71
  create spec/features/user_signs_up_spec.rb
77
72
  create spec/features/user_signs_in_spec.rb
@@ -81,12 +76,12 @@ $ rails generate devise User
81
76
 
82
77
  If a Devise model is already present, run the `devise:specs` generator directly:
83
78
  ```
84
- $ rails generate devise:specs User
79
+ $ bin/rails generate devise:specs User
85
80
  ```
86
81
 
87
82
  Run the migrations:
88
83
  ```
89
- $ rake db:migrate RAILS_ENV=test
84
+ $ bin/rails db:migrate RAILS_ENV=test
90
85
  ```
91
86
 
92
87
  Make sure the specs pass:
@@ -116,9 +111,9 @@ Adds `email` and `password` attributes to the fabricator.
116
111
 
117
112
  Adds `email` and `password` attributes to the factory.
118
113
 
119
- `create spec/support/factory_girl.rb`
114
+ `create spec/support/factory_bot.rb`
120
115
 
121
- Includes `FactoryGirl::Syntax::Methods` into RSpec config to avoid prefacing Factory Girl methods with `FactoryGirl`.
116
+ Includes `FactoryBot::Syntax::Methods` into RSpec config to avoid prefacing Factory Bot methods with `FactoryBot`.
122
117
 
123
118
  `create spec/support/devise.rb`
124
119
 
@@ -130,14 +125,7 @@ Generates a corresponding feature spec.
130
125
 
131
126
  ## Testing
132
127
 
133
- Install Ruby, development tools, Nokogiri, SQLite and JavaScript runtime system dependencies.
134
-
135
- On Ubuntu/Mint/Debian:
136
- ```
137
- $ apt-get install ruby-full build-essential zlib1g-dev libsqlite3-dev nodejs
138
- ```
139
-
140
- Install development dependencies with `bundle install` and run the tests:
128
+ Install system and development dependencies and run the tests:
141
129
  ```
142
130
  $ bundle exec rake
143
131
  ```
@@ -145,3 +133,8 @@ $ bundle exec rake
145
133
  ## License
146
134
 
147
135
  MIT License
136
+
137
+ [ci-image]: https://github.com/ponosoft/devise-specs/actions/workflows/build.yml/badge.svg
138
+ [ci]: https://github.com/ponosoft/devise-specs/actions/workflows/build.yml
139
+ [grade-image]: https://api.codeclimate.com/v1/badges/b7e541f2f5171790638f/maintainability
140
+ [grade]: https://codeclimate.com/github/ponosoft/devise-specs/maintainability
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --publish-quiet
data/devise-specs.gemspec CHANGED
@@ -1,17 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'devise-specs'
3
- s.version = '0.0.4'
3
+ s.version = '0.0.5'
4
4
  s.authors = ['Andrii Ponomarov']
5
5
  s.email = 'andrii.ponomarov@gmail.com'
6
6
  s.summary = 'Generates the Devise acceptance tests.'
7
- s.homepage = 'https://github.com/andrii/devise-specs'
7
+ s.homepage = 'https://github.com/ponosoft/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'
12
10
 
13
- s.add_runtime_dependency 'devise', '~> 4.2'
11
+ s.required_ruby_version = '>= 2.5.0'
14
12
 
15
- s.add_development_dependency 'rake', '~> 11.1'
16
- s.add_development_dependency 'aruba', '~> 0.14.1'
13
+ s.add_runtime_dependency 'devise', '~> 4.8'
14
+
15
+ s.add_development_dependency 'aruba', '~> 1.1', '>= 1.1.2'
16
+ s.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
17
17
  end
@@ -2,28 +2,29 @@ module Devise
2
2
  module Generators
3
3
  class SpecsGenerator < Rails::Generators::NamedBase
4
4
  ATTRIBUTES = %(
5
- email 'username@example.com'
6
- password 'password')
5
+ email { 'username@example.com' }
6
+ password { 'password' }
7
+ ).freeze
7
8
 
8
- source_root File.expand_path("../templates", __FILE__)
9
+ source_root File.expand_path('../templates', __FILE__)
9
10
 
10
- def require_supporting_files
11
- uncomment_lines 'spec/rails_helper.rb', /spec.support.*rb.*require/
11
+ def require_support_files
12
+ uncomment_lines 'spec/rails_helper.rb', /spec.*support.*rb.*require/
12
13
  end
13
14
 
14
15
  def insert_fixture_replacement_attributes
15
16
  return if behavior == :revoke
16
17
 
17
- if fixture_replacement == :factory_girl
18
- insert_factory_girl_attributes
18
+ if fixture_replacement == :factory_bot
19
+ insert_factory_bot_attributes
19
20
  elsif fixture_replacement == :fabrication
20
21
  insert_fabrication_attributes
21
22
  end
22
23
  end
23
24
 
24
- def create_factory_girl_config_file
25
- if fixture_replacement == :factory_girl
26
- template 'factory_girl.rb', 'spec/support/factory_girl.rb'
25
+ def create_factory_bot_config_file
26
+ if fixture_replacement == :factory_bot
27
+ template 'factory_bot.rb', 'spec/support/factory_bot.rb'
27
28
  end
28
29
  end
29
30
 
@@ -51,7 +52,7 @@ module Devise
51
52
  Rails.application.config.generators.rails[:fixture_replacement]
52
53
  end
53
54
 
54
- def insert_factory_girl_attributes
55
+ def insert_factory_bot_attributes
55
56
  path = "spec/factories/#{plural_name}.rb"
56
57
  attrs = ATTRIBUTES.gsub(/^ {4}/, '')
57
58
  after = "factory :#{singular_name} do"
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryBot::Syntax::Methods
3
+ end
@@ -1,8 +1,8 @@
1
1
  require 'rails_helper'
2
2
 
3
- feature '<%= human_name %> resets a password' do
3
+ RSpec.feature '<%= human_name %> resets a password' do
4
4
  scenario '<%= singular_name %> enters a valid email' do
5
- <% if fixture_replacement == :factory_girl -%>
5
+ <% if fixture_replacement == :factory_bot -%>
6
6
  <%= singular_name %> = create :<%= singular_name %>
7
7
  <% elsif fixture_replacement == :fabrication -%>
8
8
  <%= singular_name %> = Fabricate :<%= singular_name %>
@@ -27,7 +27,7 @@ feature '<%= human_name %> resets a password' do
27
27
  end
28
28
 
29
29
  scenario '<%= singular_name %> changes password' do
30
- <% if fixture_replacement == :factory_girl -%>
30
+ <% if fixture_replacement == :factory_bot -%>
31
31
  token = create(:<%= singular_name %>).send_reset_password_instructions
32
32
  <% elsif fixture_replacement == :fabrication -%>
33
33
  token = Fabricate(:<%= singular_name %>).send_reset_password_instructions
@@ -1,8 +1,8 @@
1
1
  require 'rails_helper'
2
2
 
3
- feature '<%= human_name %> signs in' do
3
+ RSpec.feature '<%= human_name %> signs in' do
4
4
  scenario 'with valid credentials' do
5
- <% if fixture_replacement == :factory_girl -%>
5
+ <% if fixture_replacement == :factory_bot -%>
6
6
  <%= singular_name %> = create :<%= singular_name %>
7
7
  <% elsif fixture_replacement == :fabrication -%>
8
8
  <%= singular_name %> = Fabricate :<%= singular_name %>
@@ -20,7 +20,7 @@ feature '<%= human_name %> signs in' do
20
20
  end
21
21
 
22
22
  scenario 'with invalid credentials' do
23
- <% if fixture_replacement == :factory_girl -%>
23
+ <% if fixture_replacement == :factory_bot -%>
24
24
  <%= singular_name %> = build :<%= singular_name %>
25
25
  <% elsif fixture_replacement == :fabrication -%>
26
26
  <%= singular_name %> = Fabricate.build :<%= singular_name %>
@@ -1,8 +1,8 @@
1
1
  require 'rails_helper'
2
2
 
3
- feature '<%= human_name %> signs out' do
3
+ RSpec.feature '<%= human_name %> signs out' do
4
4
  scenario '<%= singular_name %> signed in' do
5
- <% if fixture_replacement == :factory_girl -%>
5
+ <% if fixture_replacement == :factory_bot -%>
6
6
  <%= singular_name %> = create :<%= singular_name %>
7
7
  <% elsif fixture_replacement == :fabrication -%>
8
8
  <%= singular_name %> = Fabricate :<%= singular_name %>
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- feature '<%= human_name %> signs up' do
3
+ RSpec.feature '<%= human_name %> signs up' do
4
4
  scenario 'with valid data' do
5
5
  visit new_<%= singular_name %>_registration_path
6
6
 
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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrii Ponomarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-08 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -16,66 +16,78 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '4.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '4.8'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: aruba
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '11.1'
33
+ version: '1.1'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.1.2
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '11.1'
43
+ version: '1.1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.1.2
41
47
  - !ruby/object:Gem::Dependency
42
- name: aruba
48
+ name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: 0.14.1
53
+ version: '13.0'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 13.0.6
48
57
  type: :development
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
61
  - - "~>"
53
62
  - !ruby/object:Gem::Version
54
- version: 0.14.1
63
+ version: '13.0'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 13.0.6
55
67
  description:
56
68
  email: andrii.ponomarov@gmail.com
57
69
  executables: []
58
70
  extensions: []
59
71
  extra_rdoc_files: []
60
72
  files:
61
- - ".codeclimate.yml"
73
+ - ".github/workflows/build.yml"
62
74
  - ".gitignore"
63
- - ".travis.yml"
64
75
  - CHANGELOG.md
65
76
  - Gemfile
66
77
  - README.md
67
78
  - Rakefile
79
+ - cucumber.yml
68
80
  - devise-specs.gemspec
69
81
  - lib/devise-specs.rb
70
82
  - lib/devise/specs/railtie.rb
71
83
  - lib/generators/devise/specs_generator.rb
72
84
  - lib/generators/devise/templates/devise.rb.tt
73
- - lib/generators/devise/templates/factory_girl.rb.tt
85
+ - lib/generators/devise/templates/factory_bot.rb.tt
74
86
  - lib/generators/devise/templates/resource_resets_password_spec.rb.tt
75
87
  - lib/generators/devise/templates/resource_signs_in_spec.rb.tt
76
88
  - lib/generators/devise/templates/resource_signs_out_spec.rb.tt
77
89
  - lib/generators/devise/templates/resource_signs_up_spec.rb.tt
78
- homepage: https://github.com/andrii/devise-specs
90
+ homepage: https://github.com/ponosoft/devise-specs
79
91
  licenses:
80
92
  - MIT
81
93
  metadata: {}
@@ -87,15 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
99
  requirements:
88
100
  - - ">="
89
101
  - !ruby/object:Gem::Version
90
- version: 2.1.0
102
+ version: 2.5.0
91
103
  required_rubygems_version: !ruby/object:Gem::Requirement
92
104
  requirements:
93
105
  - - ">="
94
106
  - !ruby/object:Gem::Version
95
107
  version: '0'
96
108
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.5.1
109
+ rubygems_version: 3.1.6
99
110
  signing_key:
100
111
  specification_version: 4
101
112
  summary: Generates the Devise acceptance tests.
data/.codeclimate.yml DELETED
@@ -1,18 +0,0 @@
1
- ---
2
- engines:
3
- duplication:
4
- enabled: true
5
- config:
6
- languages:
7
- - ruby
8
- exclude_fingerprints:
9
- - 3b39f38c33cdc3b6dc57a5d8160f707b
10
- fixme:
11
- enabled: true
12
- rubocop:
13
- enabled: true
14
- ratings:
15
- paths:
16
- - "**.rb"
17
- exclude_paths:
18
- - features/
data/.travis.yml DELETED
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.1
@@ -1,3 +0,0 @@
1
- RSpec.configure do |config|
2
- config.include FactoryGirl::Syntax::Methods
3
- end