Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Move setup to spec_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mnoack committed Nov 9, 2015
1 parent 90bde59 commit 9057a9b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 36 deletions.
18 changes: 0 additions & 18 deletions spec/action_controller_extensions_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
require 'spec_helper'

DB_FILE = 'tmp/test_db'
FileUtils.mkdir_p File.dirname(DB_FILE)
FileUtils.rm_f DB_FILE

ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => DB_FILE

load('spec/schema.rb')

Right.rights_yaml 'db/rights_roles.yml'

class Model < ActiveRecord::Base
restricted_by_right
end

class User < ActiveRecord::Base
include RightOn::RoleModel
end

require 'action_controller'
class AdminController < ActionController::Base
include RightOn::ActionControllerExtensions
Expand Down
18 changes: 0 additions & 18 deletions spec/right_on_spec.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
require 'spec_helper'

DB_FILE = 'tmp/test_db'
FileUtils.mkdir_p File.dirname(DB_FILE)
FileUtils.rm_f DB_FILE

ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => DB_FILE

load('spec/schema.rb')

Right.rights_yaml 'db/rights_roles.yml'

class Model < ActiveRecord::Base
restricted_by_right
end

class User < ActiveRecord::Base
include RightOn::RoleModel
end

describe User do
let(:basic_user) { User.where(name: 'basic').first }
let(:admin_user) { User.where(name: 'admin').first }
Expand Down
18 changes: 18 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@
Right.cache = ActiveSupport::Cache::MemoryStore.new
end
end

DB_FILE = 'tmp/test_db'
FileUtils.mkdir_p File.dirname(DB_FILE)
FileUtils.rm_f DB_FILE

ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => DB_FILE

load('spec/schema.rb')

Right.rights_yaml 'db/rights_roles.yml'

class Model < ActiveRecord::Base
restricted_by_right
end

class User < ActiveRecord::Base
include RightOn::RoleModel
end

0 comments on commit 9057a9b

Please sign in to comment.