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 dd4840d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 37 deletions.
2 changes: 1 addition & 1 deletion lib/right_on/action_controller_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def access_allowed?(opts={})

# Called if a security check determines permission is denied
def permission_denied
@permission_denied_response = PermissionDeniedResponse.new(params, controller_action_options)
@permission_denied_response = RightOn::PermissionDeniedResponse.new(params, controller_action_options)

respond_to do |format|
format.html { render status: 401, template: 'permission_denied', layout: (permission_denied_layout || false) }
Expand Down
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 dd4840d

Please sign in to comment.