Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chris Boertien <chris.boertien@gmail.com>
- Loading branch information
1 parent
2145e74
commit 10a2fa2
Showing
6 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ tmp/ | |
.sass-cache/ | ||
Gemfile.lock | ||
config/database.yml | ||
.rvmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--colour --drb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'factory_girl' | ||
|
||
Dir["#{File.dirname(__FILE__)}/factories/**"].each do |f| | ||
fp = File.expand_path(f) | ||
require fp | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'spork' | ||
|
||
Spork.prefork do | ||
ENV["RAILS_ENV"] ||= 'test' | ||
require File.expand_path("../../config/environment", __FILE__) | ||
require 'rspec/rails' | ||
require 'shoulda/integrations/rspec2' | ||
|
||
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | ||
|
||
RSpec.configure do |config| | ||
config.mock_with :rspec | ||
config.fixture_path = "#{::Rails.root}/spec/fixtures" | ||
config.use_transactional_fixtures = true | ||
config.include Devise::TestHelpers, :type => :controller | ||
config.extend ControllerMacros, :type => :controller | ||
end | ||
|
||
RSpec::Matchers.define :have_valid_factory do |factory| | ||
match do |model| | ||
Factory(factory).new_record?.should be_false | ||
end | ||
end | ||
end | ||
|
||
Spork.each_run do | ||
require 'factories' | ||
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module ControllerMacros | ||
def login_admin | ||
before :each do | ||
@request.env["devise.mapping"] = Devise.mappings[:user] | ||
@admin = Factory(:admin) | ||
sign_in @admin | ||
end | ||
end | ||
|
||
def login_user | ||
before :each do | ||
@request.env['devise.mapping'] = Devise.mappings[:user] | ||
@user = Factory(:user) | ||
sign_in @user | ||
end | ||
end | ||
end |