Skip to content

Commit

Permalink
Update RSpec to 3
Browse files Browse the repository at this point in the history
  • Loading branch information
maurogeorge committed Jul 20, 2014
1 parent 4ed4063 commit 05caf15
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 57 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Expand Up @@ -2,14 +2,18 @@

## 1.1.1 (Unreleased)

### bug fixes

- Do not modify original url when using cdn

### features

- filepicker_image_tag now works with policies

### improvements

- update to RSpec 3

### bug fixes

- Do not modify original url when using cdn

## 1.1.0 (March 30, 2014)

### features
Expand Down
2 changes: 1 addition & 1 deletion filepicker_rails.gemspec
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|

s.add_development_dependency 'coveralls'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'rspec-rails', '2.99'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'timecop'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'capybara'
Expand Down
4 changes: 2 additions & 2 deletions spec/features/rails_integration_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

feature 'Rails integration' do
RSpec.feature 'Rails integration' do

background do
visit '/'
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/application_helper_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe FilepickerRails::ApplicationHelper do
RSpec.describe FilepickerRails::ApplicationHelper do

describe "#filepicker_js_include_tag" do

Expand Down
5 changes: 2 additions & 3 deletions spec/helpers/form_helper_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
require 'timecop'
require 'rails_helper'

describe FilepickerRails::FormHelper do
RSpec.describe FilepickerRails::FormHelper do

let!(:form) do
if rails_4_1_x?
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/configuration_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe FilepickerRails::Configuration do
RSpec.describe FilepickerRails::Configuration do

let!(:configuration) do
FilepickerRails::Configuration.new
Expand Down
20 changes: 20 additions & 0 deletions spec/rails_helper.rb
@@ -0,0 +1,20 @@
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rails'
require 'capybara/rspec'

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }

if RailsVersions.rails_4_1_x?
ActiveRecord::Migration.maintain_test_schema!
end

RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.render_views
end
58 changes: 15 additions & 43 deletions spec/spec_helper.rb
@@ -1,51 +1,23 @@
require 'coveralls'
Coveralls.wear!

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'
require 'timecop'
require 'pry'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each do |file|
require file
end

RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true

# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"

config.expect_with :rspec do |c|
c.syntax = :expect
config.disable_monkey_patching!
config.order = :random
Kernel.srand config.seed
config.filter_run focus: true
config.run_all_when_everything_filtered = true
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
end
config.mock_with :rspec do |mocks|
mocks.syntax = :expect
mocks.verify_partial_doubles = true
end
if config.files_to_run.one?
config.default_formatter = 'doc'
end
end
2 changes: 2 additions & 0 deletions spec/support/rails_versions.rb
Expand Up @@ -2,10 +2,12 @@ module RailsVersions
def rails_version
Gem::Version.new(Rails::VERSION::STRING)
end
module_function :rails_version

def rails_4_1_x?
Gem::Requirement.new('~> 4.1').satisfied_by?(rails_version)
end
module_function :rails_4_1_x?
end

RSpec.configure do |config|
Expand Down

0 comments on commit 05caf15

Please sign in to comment.