clearance 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of clearance might be problematic. Click here for more details.

@@ -1,16 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'routes for Clearance' do
4
- context 'signup disabled' do
5
- before(:all) do
6
- Clearance.configure do |config|
7
- config.allow_sign_up = false
8
- end
4
+ context 'routes enabled' do
5
+ it 'draws the default routes' do
6
+ expect(get: 'sign_up').to be_routable
7
+ expect(get: 'sign_in').to be_routable
8
+ expect(get: 'passwords/new').to be_routable
9
+ expect(post: 'session').to be_routable
10
+ expect(post: 'passwords').to be_routable
11
+ expect(post: 'users').to be_routable
12
+ end
13
+ end
9
14
 
15
+ context 'routes disabled' do
16
+ around do |example|
17
+ Clearance.configure { |config| config.routes = false }
18
+ Rails.application.reload_routes!
19
+ example.run
20
+ Clearance.configuration = Clearance::Configuration.new
10
21
  Rails.application.reload_routes!
11
22
  end
12
23
 
13
- after :all do
24
+ it 'does not draw any routes' do
25
+ expect(get: 'sign_up').not_to be_routable
26
+ expect(get: 'sign_in').not_to be_routable
27
+ expect(get: 'passwords/new').not_to be_routable
28
+ expect(post: 'session').not_to be_routable
29
+ expect(post: 'passwords').not_to be_routable
30
+ expect(post: 'users').not_to be_routable
31
+ end
32
+ end
33
+
34
+ context 'signup disabled' do
35
+ around do |example|
36
+ Clearance.configure { |config| config.allow_sign_up = false }
37
+ Rails.application.reload_routes!
38
+ example.run
14
39
  Clearance.configuration = Clearance::Configuration.new
15
40
  Rails.application.reload_routes!
16
41
  end
data/spec/spec_helper.rb CHANGED
@@ -24,6 +24,7 @@ RSpec.configure do |config|
24
24
  config.include FactoryGirl::Syntax::Methods
25
25
  config.mock_with :mocha
26
26
  config.use_transactional_fixtures = true
27
+ config.infer_spec_type_from_file_location!
27
28
  end
28
29
 
29
30
  def restore_default_config
@@ -19,16 +19,16 @@ RSpec::Matchers.define :set_cookie do |name, expected_value, expected_expires_at
19
19
  end
20
20
 
21
21
  def ensure_cookie_set
22
- @value.should == @expected_value
22
+ expect(@value).to eq @expected_value
23
23
  end
24
24
 
25
25
  def ensure_expiration_correct
26
- @expires_at.should_not be_nil
27
- @expires_at.should be_within(100).of(@expected_expires_at)
26
+ expect(@expires_at).not_to be_nil
27
+ expect(@expires_at).to be_within(100).of(@expected_expires_at)
28
28
  end
29
29
 
30
30
  def ensure_path_is_correct
31
- @path.should == "/"
31
+ expect(@path).to eq '/'
32
32
  end
33
33
 
34
34
  def expectation
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -25,7 +25,7 @@ authors:
25
25
  autorequire:
26
26
  bindir: bin
27
27
  cert_chain: []
28
- date: 2014-10-03 00:00:00.000000000 Z
28
+ date: 2014-10-17 00:00:00.000000000 Z
29
29
  dependencies:
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: bcrypt
@@ -110,6 +110,7 @@ files:
110
110
  - db/migrate/20110111224543_create_clearance_users.rb
111
111
  - db/schema.rb
112
112
  - features/add_migrations_to_project.feature
113
+ - features/copy_routes_to_host_application.feature
113
114
  - features/integration_with_rspec.feature
114
115
  - features/integration_with_test_unit.feature
115
116
  - features/step_definitions/configuration_steps.rb
@@ -155,6 +156,8 @@ files:
155
156
  - lib/generators/clearance/install/templates/db/migrate/add_clearance_to_users.rb
156
157
  - lib/generators/clearance/install/templates/db/migrate/create_users.rb
157
158
  - lib/generators/clearance/install/templates/user.rb
159
+ - lib/generators/clearance/routes/routes_generator.rb
160
+ - lib/generators/clearance/routes/templates/routes.rb
158
161
  - lib/generators/clearance/specs/USAGE
159
162
  - lib/generators/clearance/specs/specs_generator.rb
160
163
  - lib/generators/clearance/specs/templates/factories/clearance.rb
@@ -181,7 +184,6 @@ files:
181
184
  - spec/clearance/token_spec.rb
182
185
  - spec/configuration_spec.rb
183
186
  - spec/controllers/apis_controller_spec.rb
184
- - spec/controllers/flashes_controller_spec.rb
185
187
  - spec/controllers/forgeries_controller_spec.rb
186
188
  - spec/controllers/passwords_controller_spec.rb
187
189
  - spec/controllers/permissions_controller_spec.rb
@@ -228,6 +230,7 @@ specification_version: 4
228
230
  summary: Rails authentication & authorization with email & password.
229
231
  test_files:
230
232
  - features/add_migrations_to_project.feature
233
+ - features/copy_routes_to_host_application.feature
231
234
  - features/integration_with_rspec.feature
232
235
  - features/integration_with_test_unit.feature
233
236
  - features/step_definitions/configuration_steps.rb
@@ -245,7 +248,6 @@ test_files:
245
248
  - spec/clearance/token_spec.rb
246
249
  - spec/configuration_spec.rb
247
250
  - spec/controllers/apis_controller_spec.rb
248
- - spec/controllers/flashes_controller_spec.rb
249
251
  - spec/controllers/forgeries_controller_spec.rb
250
252
  - spec/controllers/passwords_controller_spec.rb
251
253
  - spec/controllers/permissions_controller_spec.rb
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class FlashesController < ActionController::Base
4
- include Clearance::Controller
5
-
6
- def set_flash
7
- flash[:notice] = params[:message]
8
- redirect_to view_flash_url
9
- end
10
-
11
- def view_flash
12
- render text: "<html><body>#{flash[:notice]}</body></html>"
13
- end
14
- end
15
-
16
- describe FlashesController do
17
- before do
18
- Rails.application.routes.draw do
19
- get '/set_flash' => 'flashes#set_flash'
20
- get '/view_flash' => 'flashes#view_flash'
21
- end
22
- end
23
-
24
- after do
25
- Rails.application.reload_routes!
26
- end
27
-
28
- it 'sets and views a flash' do
29
- visit '/set_flash?message=hello'
30
- page.should have_content('hello')
31
- end
32
- end