Skip to content

Commit

Permalink
Merge pull request #413 from mikwat/fix-specs
Browse files Browse the repository at this point in the history
Fix specs
  • Loading branch information
wldcordeiro committed Sep 30, 2016
2 parents 34ed256 + 4f0205b commit 9f1cdb4
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Appraisals
Expand Up @@ -15,12 +15,12 @@ end

appraise 'activerecord-3' do
gem "sqlite3", :platform => "ruby"
gem "activerecord", ">= 3.2.0", :require => "active_record"
gem "activerecord", "~> 3.2.0", :require => "active_record"
end

appraise 'activerecord-4' do
gem "sqlite3", :platform => "ruby"
gem "activerecord", ">= 4.2.5", :require => "active_record"
gem "activerecord", "~> 4.2.5", :require => "active_record"
end

appraise 'activerecord-5' do
Expand Down
4 changes: 2 additions & 2 deletions gemfiles/activerecord_3.gemfile
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"

gem "sqlite3", :platform => "ruby"
gem "activerecord", ">= 3.2.0", :require => "active_record"
gem "activerecord", "~> 3.2.0", :require => "active_record"

group :test do
gem "appraisal"
Expand All @@ -12,7 +12,7 @@ group :test do
gem "byebug"
gem "pry-byebug"
gem "test-unit"
gem "database_cleaner"
gem "database_cleaner", "~> 1.5.3"
gem "codeclimate-test-reporter", :require => nil
end

Expand Down
4 changes: 2 additions & 2 deletions gemfiles/activerecord_4.gemfile
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"

gem "sqlite3", :platform => "ruby"
gem "activerecord", ">= 4.2.5", :require => "active_record"
gem "activerecord", "~> 4.2.5", :require => "active_record"

group :test do
gem "appraisal"
Expand All @@ -12,7 +12,7 @@ group :test do
gem "byebug"
gem "pry-byebug"
gem "test-unit"
gem "database_cleaner"
gem "database_cleaner", "~> 1.5.3"
gem "codeclimate-test-reporter", :require => nil
end

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/activerecord_5.gemfile
Expand Up @@ -20,7 +20,7 @@ group :test do
gem "byebug"
gem "pry-byebug"
gem "test-unit"
gem "database_cleaner"
gem "database_cleaner", "~> 1.5.3"
gem "codeclimate-test-reporter", :require => nil
end

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/mongoid_3.gemfile
Expand Up @@ -12,7 +12,7 @@ group :test do
gem "byebug"
gem "pry-byebug"
gem "test-unit"
gem "database_cleaner"
gem "database_cleaner", "~> 1.5.3"
gem "codeclimate-test-reporter", :require => nil
end

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/mongoid_4.gemfile
Expand Up @@ -12,7 +12,7 @@ group :test do
gem "byebug"
gem "pry-byebug"
gem "test-unit"
gem "database_cleaner"
gem "database_cleaner", "~> 1.5.3"
gem "codeclimate-test-reporter", :require => nil
end

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/mongoid_5.gemfile
Expand Up @@ -12,7 +12,7 @@ group :test do
gem "byebug"
gem "pry-byebug"
gem "test-unit"
gem "database_cleaner"
gem "database_cleaner", "~> 1.5.3"
gem "codeclimate-test-reporter", :require => nil
end

Expand Down
24 changes: 21 additions & 3 deletions spec/generators/rolify/rolify_activerecord_generator_spec.rb
Expand Up @@ -43,7 +43,13 @@ class User < ActiveRecord::Base
describe 'app/models/role.rb' do
subject { file('app/models/role.rb') }
it { should exist }
it { should contain "class Role < ActiveRecord::Base" }
it do
if Rails::VERSION::MAJOR < 5
should contain "class Role < ActiveRecord::Base"
else
should contain "class Role < ApplicationRecord"
end
end
it { should contain "has_and_belongs_to_many :users, :join_table => :users_roles" }
it do
if Rails::VERSION::MAJOR < 5
Expand Down Expand Up @@ -104,7 +110,13 @@ class User < ActiveRecord::Base
subject { file('app/models/admin_role.rb') }

it { should exist }
it { should contain "class AdminRole < ActiveRecord::Base" }
it do
if Rails::VERSION::MAJOR < 5
should contain "class AdminRole < ActiveRecord::Base"
else
should contain "class AdminRole < ApplicationRecord"
end
end
it { should contain "has_and_belongs_to_many :admin_users, :join_table => :admin_users_admin_roles" }
it { should contain "belongs_to :resource,\n"
" :polymorphic => true,\n"
Expand Down Expand Up @@ -159,7 +171,13 @@ class User < ActiveRecord::Base
subject { file('app/models/admin/role.rb') }

it { should exist }
it { should contain "class Admin::Role < ActiveRecord::Base" }
it do
if Rails::VERSION::MAJOR < 5
should contain "class Admin::Role < ActiveRecord::Base"
else
should contain "class Admin::Role < ApplicationRecord"
end
end
it { should contain "has_and_belongs_to_many :admin_users, :join_table => :admin_users_admin_roles" }
it { should contain "belongs_to :resource,\n"
" :polymorphic => true,\n"
Expand Down

0 comments on commit 9f1cdb4

Please sign in to comment.