devise-spec 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/.rspec +1 -0
- data/LICENSE +20 -0
- data/README.markdown +53 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/lib/devise-spec.rb +3 -0
- data/lib/matchers/have_devise_options.rb +13 -0
- data/lib/rspec/configure.rb +7 -0
- data/spec/devise-spec/matchers/have_devise_options_active_record_spec.rb +29 -0
- data/spec/devise-spec/matchers/have_devise_options_spec.rb +29 -0
- data/spec/spec_helper.rb +31 -0
- metadata +155 -0
data/.document
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Kristian Mandrup
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Devise spec
|
2
|
+
|
3
|
+
Spec User model files with Devise strategies specified.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
<code>gem install devise-spec</code>
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Teaser:
|
12
|
+
<pre>
|
13
|
+
root_dir.should have_model :user do |clazz|
|
14
|
+
clazz.should have_default_devise_options
|
15
|
+
clazz.should have_devise_options :database_authenticatable, :confirmable
|
16
|
+
end
|
17
|
+
</pre>
|
18
|
+
|
19
|
+
Full RSpec example:
|
20
|
+
<pre>
|
21
|
+
root_dir = Rails3::Assist::Directory.rails_root
|
22
|
+
|
23
|
+
describe 'Options are present in devise User model' do
|
24
|
+
use_orm :none
|
25
|
+
|
26
|
+
it "should have the User model setup with the default devise strategies" do
|
27
|
+
create_model :user do
|
28
|
+
%q{
|
29
|
+
devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
root_dir.should have_model :user do |clazz|
|
34
|
+
clazz.should have_default_devise_options
|
35
|
+
clazz.should have_devise_options :database_authenticatable, :confirmable
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
</pre>
|
40
|
+
|
41
|
+
## Note on Patches/Pull Requests
|
42
|
+
|
43
|
+
* Fork the project.
|
44
|
+
* Make your feature addition or bug fix.
|
45
|
+
* Add tests for it. This is important so I don't break it in a
|
46
|
+
future version unintentionally.
|
47
|
+
* Commit, do not mess with rakefile, version, or history.
|
48
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
49
|
+
* Send me a pull request. Bonus points for topic branches.
|
50
|
+
|
51
|
+
## Copyright
|
52
|
+
|
53
|
+
Copyright (c) 2010 Kristian Mandrup. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'jeweler'
|
3
|
+
Jeweler::Tasks.new do |gem|
|
4
|
+
gem.name = "devise-spec"
|
5
|
+
gem.summary = %Q{Spec your devise User files}
|
6
|
+
gem.description = %Q{RSpec matchers to help spec your devise User files}
|
7
|
+
gem.email = "kmandrup@gmail.com"
|
8
|
+
gem.homepage = "http://github.com/kristianmandrup/devise-spec"
|
9
|
+
gem.authors = ["Kristian Mandrup"]
|
10
|
+
gem.add_dependency "rspec", "~> 2.0.0.beta.22"
|
11
|
+
gem.add_dependency "require_all", "~> 1.1.0"
|
12
|
+
gem.add_dependency "rails-app-spec", "~> 0.2.9"
|
13
|
+
gem.add_dependency "rails3_artifactor", "~> 0.2.2"
|
14
|
+
gem.add_dependency "code-spec", "~> 0.2.1"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/devise-spec.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'code-spec'
|
2
|
+
|
3
|
+
module RSpec::RubyContentMatchers
|
4
|
+
module Devise
|
5
|
+
def have_default_devise_options
|
6
|
+
have_call "devise", :args => [:database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable]
|
7
|
+
end
|
8
|
+
|
9
|
+
def have_devise_options *names
|
10
|
+
have_call "devise", :args => names
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
root_dir = Rails3::Assist::Directory.rails_root
|
4
|
+
|
5
|
+
describe 'RSpec matcher to spec that auth options are present in devise User model' do
|
6
|
+
use_orm :active_record
|
7
|
+
use_helpers :model
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
create_model :user do
|
11
|
+
%q{
|
12
|
+
devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable
|
13
|
+
}
|
14
|
+
end
|
15
|
+
puts read_model :user
|
16
|
+
end
|
17
|
+
|
18
|
+
after :each do
|
19
|
+
remove_model :user
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have the User model setup with the default devise strategies" do
|
23
|
+
root_dir.should have_model :user do |clazz|
|
24
|
+
clazz.should have_default_devise_options
|
25
|
+
clazz.should have_devise_options :database_authenticatable, :confirmable
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
root_dir = Rails3::Assist::Directory.rails_root
|
4
|
+
|
5
|
+
describe 'RSpec matcher to spec that auth options are present in devise User model' do
|
6
|
+
use_orm :none
|
7
|
+
use_helpers :model
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
create_model :user do
|
11
|
+
%q{
|
12
|
+
devise :database_authenticatable, :confirmable, :recoverable, :rememberable, :trackable, :validatable
|
13
|
+
}
|
14
|
+
end
|
15
|
+
puts read_model :user
|
16
|
+
end
|
17
|
+
|
18
|
+
after :each do
|
19
|
+
remove_model :user
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have the User model setup with the default devise strategies" do
|
23
|
+
root_dir.should have_model :user do |clazz|
|
24
|
+
clazz.should have_default_devise_options
|
25
|
+
clazz.should have_devise_options :database_authenticatable, :confirmable
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
require 'devise-spec'
|
3
|
+
require 'rails-app-spec'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.mock_with :mocha
|
7
|
+
config.before do
|
8
|
+
Rails3::Assist::Directory.rails_root = temp_dir('tmp_rails')
|
9
|
+
end
|
10
|
+
|
11
|
+
config.after do
|
12
|
+
remove_temp_dir 'tmp_rails'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def project_dir
|
17
|
+
File.dirname(__FILE__) + '/..'
|
18
|
+
end
|
19
|
+
|
20
|
+
def temp_dir name
|
21
|
+
File.join(project_dir, name)
|
22
|
+
end
|
23
|
+
|
24
|
+
def make_temp_dir name
|
25
|
+
FileUtils.mkdir_p temp_dir(name)
|
26
|
+
temp_dir(name)
|
27
|
+
end
|
28
|
+
|
29
|
+
def remove_temp_dir name
|
30
|
+
FileUtils.rm_rf temp_dir(name)
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: devise-spec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Kristian Mandrup
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-09-16 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
- beta
|
33
|
+
- 22
|
34
|
+
version: 2.0.0.beta.22
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: require_all
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 1
|
48
|
+
- 0
|
49
|
+
version: 1.1.0
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: rails-app-spec
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 2
|
63
|
+
- 9
|
64
|
+
version: 0.2.9
|
65
|
+
type: :runtime
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rails3_artifactor
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
- 2
|
78
|
+
- 2
|
79
|
+
version: 0.2.2
|
80
|
+
type: :runtime
|
81
|
+
version_requirements: *id004
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: code-spec
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
- 2
|
93
|
+
- 1
|
94
|
+
version: 0.2.1
|
95
|
+
type: :runtime
|
96
|
+
version_requirements: *id005
|
97
|
+
description: RSpec matchers to help spec your devise User files
|
98
|
+
email: kmandrup@gmail.com
|
99
|
+
executables: []
|
100
|
+
|
101
|
+
extensions: []
|
102
|
+
|
103
|
+
extra_rdoc_files:
|
104
|
+
- LICENSE
|
105
|
+
- README.markdown
|
106
|
+
files:
|
107
|
+
- .document
|
108
|
+
- .gitignore
|
109
|
+
- .rspec
|
110
|
+
- LICENSE
|
111
|
+
- README.markdown
|
112
|
+
- Rakefile
|
113
|
+
- VERSION
|
114
|
+
- lib/devise-spec.rb
|
115
|
+
- lib/matchers/have_devise_options.rb
|
116
|
+
- lib/rspec/configure.rb
|
117
|
+
- spec/devise-spec/matchers/have_devise_options_active_record_spec.rb
|
118
|
+
- spec/devise-spec/matchers/have_devise_options_spec.rb
|
119
|
+
- spec/spec_helper.rb
|
120
|
+
has_rdoc: true
|
121
|
+
homepage: http://github.com/kristianmandrup/devise-spec
|
122
|
+
licenses: []
|
123
|
+
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options:
|
126
|
+
- --charset=UTF-8
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
version: "0"
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
145
|
+
requirements: []
|
146
|
+
|
147
|
+
rubyforge_project:
|
148
|
+
rubygems_version: 1.3.7
|
149
|
+
signing_key:
|
150
|
+
specification_version: 3
|
151
|
+
summary: Spec your devise User files
|
152
|
+
test_files:
|
153
|
+
- spec/devise-spec/matchers/have_devise_options_active_record_spec.rb
|
154
|
+
- spec/devise-spec/matchers/have_devise_options_spec.rb
|
155
|
+
- spec/spec_helper.rb
|