spec/spec_helper.rb in pubsub_notifier-0.1.1 vs spec/spec_helper.rb in pubsub_notifier-0.1.2

- old
+ new

@@ -1,10 +1,46 @@ +$LOAD_PATH.unshift(File.dirname(__FILE__)) +$LOAD_PATH << File.expand_path("../support", __FILE__) + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) require "bundler/setup" -require "pubsub_notifier" -require "pry" +ENV["RAILS_ENV"] ||= "test" -require_relative "support/notifiers/application_notifier" -require_relative "support/notifiers/admin_notifier" -require_relative "support/notifiers/user_notifier" -require_relative "support/models/member" -require_relative "support/models/user" +require "rails" + +ENV["RAILS"] = Rails.version +ENV["RAILS_ROOT"] = File.expand_path("../rails/rails-#{ENV["RAILS"]}", __FILE__) + +# Create the test app if it doesn't exists +system "rake setup" unless File.exist?(ENV["RAILS_ROOT"]) + +# load test app +require ENV["RAILS_ROOT"] + "/config/environment.rb" + +# load RSpec +require "rspec/rails" + +RSpec.configure do |config| + config.include FactoryGirl::Syntax::Methods + + config.expect_with :rspec do |expectations| + expectations.syntax = [:should, :expect] + end + + config.mock_with :rspec do |mocks| + mocks.syntax = [:should, :expect] + end + + config.order = :random + config.use_transactional_fixtures = true +end + +FactoryGirl.define do + factory :user do + sequence(:name) { |n| "name#{n}" } + end + + factory :post do + sequence(:name) { |n| "name#{n}" } + end +end