Skip to content

Commit 37e2edc

Browse files
committed
Spec cleanup and documentation
1 parent f64da3a commit 37e2edc

File tree

12 files changed

+36
-23
lines changed

12 files changed

+36
-23
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ RSpec/FilePath:
110110
- 'spec/omniauth/identity/models/active_record_spec.rb'
111111
- 'spec/omniauth/identity/models/couch_potato_spec.rb'
112112
- 'spec/omniauth/identity/models/mongoid_spec.rb'
113-
- 'spec/omniauth/identity/models/no_brainer_spec.rb'
113+
- 'spec/omniauth/identity/models/nobrainer_spec.rb'
114114
- 'spec/omniauth/identity/models/sequel_spec.rb'
115115
- 'spec/omniauth/identity/secure_password_spec.rb'
116116
- 'spec/omniauth/strategies/identity_spec.rb'

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Please contribute some documentation if you have the gumption! The maintainer's
273273
3. Commit your changes (`git commit -am ‘Added some feature’`)
274274
4. Push to the branch (`git push origin my-new-feature`)
275275
5. Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
276-
- NOTE: In order to run *all* the tests you will need to have the following databases installed and configured.
276+
- NOTE: In order to run *all* the tests you will need to have the following databases installed, configured, and running.
277277
1. [RethinkDB](https://rethinkdb.com), an open source, real-time, web database, [installed](https://rethinkdb.com/docs/install/) and [running](https://rethinkdb.com/docs/start-a-server/), e.g.
278278
```bash
279279
brew install rethinkdb
@@ -283,15 +283,29 @@ Please contribute some documentation if you have the gumption! The maintainer's
283283
```bash
284284
brew tap mongodb/brew
285285
brew install [email protected]
286-
286+
mongod --config /usr/local/etc/mongod.conf
287287
```
288-
To skip the RethinkDB-based, NoBrainer (ORM), tests run:
288+
3. [CouchDB](https://couchdb.apache.org) (download the .app)
289+
To run all tests on all databases:
289290
```bash
290-
bundle exec rspec spec --tag '~nobrainer'
291+
bundle exec rake
291292
```
292-
Or if you have RethinkDB setup, then run all:
293+
To run a specific DB:
293294
```bash
294-
bundle exec rspec spec
295+
# CouchDB / CouchPotato
296+
bundle exec rspec spec spec_orms --tag 'couchdb'
297+
298+
# ActiveRecord and Sequel, as they both use the in-memory SQLite driver.
299+
bundle exec rspec spec spec_orms --tag 'sqlite3'
300+
301+
# NOTE - mongoid and nobrainer specs can't be isolated with "tag" because it still loads everything,
302+
# and the two libraries are fundamentally incompatible.
303+
304+
# MongoDB / Mongoid
305+
bundle exec rspec spec_orms/mongoid_spec.rb
306+
307+
# RethinkDB / NoBrainer
308+
bundle exec rspec spec_orms/nobrainer_spec.rb
295309
```
296310
6. Create new Pull Request
297311

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ begin
1111
couch_potato.pattern = "spec_orms/couch_potato_spec.rb"
1212
mongoid = RSpec::Core::RakeTask.new(:spec_orm_mongoid)
1313
mongoid.pattern = "spec_orms/mongoid_spec.rb"
14-
no_brainer = RSpec::Core::RakeTask.new(:spec_orm_no_brainer)
15-
no_brainer.pattern = "spec_orms/no_brainer_spec.rb"
14+
nobrainer = RSpec::Core::RakeTask.new(:spec_orm_nobrainer)
15+
nobrainer.pattern = "spec_orms/nobrainer_spec.rb"
1616
sequel = RSpec::Core::RakeTask.new(:spec_orm_sequel)
1717
sequel.pattern = "spec_orms/sequel_spec.rb"
1818
rescue LoadError
@@ -36,6 +36,6 @@ task default: [
3636
:spec_orm_active_record,
3737
:spec_orm_couch_potato,
3838
:spec_orm_mongoid,
39-
:spec_orm_no_brainer,
39+
:spec_orm_nobrainer,
4040
:spec_orm_sequel
4141
]

lib/omniauth/identity.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Models
1414
autoload :ActiveRecord, 'omniauth/identity/models/active_record'
1515
autoload :Mongoid, 'omniauth/identity/models/mongoid'
1616
autoload :CouchPotatoModule, 'omniauth/identity/models/couch_potato'
17-
autoload :NoBrainer, 'omniauth/identity/models/no_brainer'
17+
autoload :NoBrainer, 'omniauth/identity/models/nobrainer'
1818
autoload :Sequel, 'omniauth/identity/models/sequel'
1919
end
2020
end

spec/omniauth/strategies/identity_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require 'active_record'
55
require 'anonymous_active_record'
66

7-
RSpec.describe OmniAuth::Strategies::Identity do
7+
RSpec.describe OmniAuth::Strategies::Identity, sqlite3: true do
88
attr_accessor :app
99

1010
let(:env_hash) { last_response.headers['env'] }

spec_orms/active_record_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require 'active_record'
55
require 'anonymous_active_record'
66

7-
RSpec.describe(OmniAuth::Identity::Models::ActiveRecord, db: :sqlite3) do
7+
RSpec.describe(OmniAuth::Identity::Models::ActiveRecord, sqlite3: true) do
88
describe 'model', type: :model do
99
subject(:model_klass) do
1010
AnonymousActiveRecord.generate(

spec_orms/couch_potato_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# frozen_string_literal: true
22

33
require 'couch_potato'
4-
require 'bcrypt'
54

6-
RSpec.describe(OmniAuth::Identity::Models::CouchPotatoModule, db: :couchdb) do
5+
RSpec.describe(OmniAuth::Identity::Models::CouchPotatoModule, couchdb: true) do
76
before(:all) do
87
CouchPotato::Config.database_name = "http://admin:[email protected]:5984/test"
98
end

spec_orms/mongoid_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# If you try it, one or both of them will not work.
55
require_relative 'support/rspec_config/mongoid'
66

7-
RSpec.describe(OmniAuth::Identity::Models::Mongoid, db: :mongodb) do
7+
RSpec.describe(OmniAuth::Identity::Models::Mongoid, mongodb: true) do
88
describe 'model', type: :model do
99
subject(:model_klass) { MongoidTestIdentity }
1010

spec_orms/no_brainer_spec.rb renamed to spec_orms/nobrainer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

3-
# NOTE: mongoid and no_brainer can't be loaded at the same time.
3+
# NOTE: mongoid and nobrainer can't be loaded at the same time.
44
# If you try it, one or both of them will not work.
55
require 'nobrainer'
66

7-
RSpec.describe(OmniAuth::Identity::Models::NoBrainer, db: :rethinkdb) do
7+
RSpec.describe(OmniAuth::Identity::Models::NoBrainer, rethinkdb: true) do
88
before(:all) do
99
NoBrainer.configure do |config|
1010
config.app_name = 'DeezBrains'

0 commit comments

Comments
 (0)