Permalink
Browse files

Updated to latest and greatest RSpec 3 syntax.

  • Loading branch information...
heycarsten committed Jul 9, 2014
1 parent 576009d commit 829911b0c74ea61b2253cffff910a574f00a585f
1 .rspec
@@ -1 +1,2 @@
--color
--require spec_helper
@@ -67,7 +67,7 @@ GEM
colorize (0.7.3)
diff-lcs (1.2.5)
erubis (2.7.0)
excon (0.37.0)
excon (0.38.0)
execjs (2.2.1)
fabrication (2.11.3)
gcoder (1.1.0)
@@ -78,7 +78,7 @@ GEM
hike (1.2.3)
honeybadger (1.15.3)
json
i18n (0.6.9)
i18n (0.6.11)
json (1.8.1)
kaminari (0.16.1)
actionpack (>= 3.0.0)
@@ -97,7 +97,7 @@ GEM
net-ssh (2.9.1)
nokogiri (1.6.2.1)
mini_portile (= 0.6.0)
oj (2.9.8)
oj (2.9.9)
pg (0.17.1)
pg_search (0.7.4)
activerecord (>= 3.1)
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

class BaseQuery < V1::QueryHelper::Query
def initialize(*args)
@@ -70,7 +70,7 @@ def mkquery(type, params = {})
end
end

describe BaseQuery do
RSpec.describe BaseQuery do
describe '#page' do
['0', 0, 'x x'].each do |page|
it "should not allow value: #{page.inspect}" do
@@ -177,7 +177,7 @@ def mkquery(type, params = {})
end
end

describe V1::QueryHelper::ProductsQuery do
RSpec.describe V1::QueryHelper::ProductsQuery do
before do
Fabricate(:product, name: 'Magic Merlot')
Fabricate(:product, name: 'Sassy Shiraz')
@@ -197,7 +197,7 @@ def mkquery(type, params = {})
end
end

describe V1::QueryHelper::StoresQuery do
RSpec.describe V1::QueryHelper::StoresQuery do
before do
@store_1 = Fabricate(:store, name: 'Toronto', latitude: 43.65285, longitude: -79.38143)
@store_2 = Fabricate(:store, name: 'London', latitude: 42.97941, longitude: -81.24608)
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe Crawl, 'with nil store_nos and product_nos' do
RSpec.describe Crawl, 'with nil store_nos and product_nos', type: :model do
let(:crawl) { Fabricate(:crawl, product_ids: nil, store_ids: nil) }

it 'should exist' do
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe Key do
RSpec.describe Key, type: :model do
end
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe User, '(creation)' do
RSpec.describe User, '(creation)', type: :model do
describe '#password' do
it 'is required' do
u = User.create(name: 'Carsten', email: 'hi@example.com')
@@ -0,0 +1,41 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'fabrication'

# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
# 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

# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
end
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'Datasets API (V1)' do
RSpec.describe 'Datasets API (V1)', type: :request do
before do
@crawls = [
Fabricate(:crawl),
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'Inventories API (V1)' do
RSpec.describe 'Inventories API (V1)', type: :request do
before do
@products = [
Fabricate(:product),
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'Products API (V1)' do
RSpec.describe 'Products API (V1)', type: :request do
before do
@product1 = Fabricate(:product, id: '1')
@product2 = Fabricate(:product, id: '2', name: 'Fitzgibbons')
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'API resource (V1)' do
RSpec.describe 'API resource (V1)', type: :request do
describe 'with JS format and no callback' do
before { get '/datasets.js' }

@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'Stores API (V1)' do
RSpec.describe 'Stores API (V1)', type: :request do
before do
@store1 = Fabricate(:store)
@store2 = Fabricate(:store, name: 'Test Store')
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'V1 Inventory resources routing' do
RSpec.describe 'V1 Inventory resources routing', type: :routing do
it 'routes /inventories' do
expect(get '/inventories').to route_to(
controller: 'api/v1/inventories',
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'V1 Legacy routing' do
RSpec.describe 'V1 Legacy routing', type: :routing do
it 'routes /products/:product_no' do
expect(get '/products/18').to route_to(
controller: 'api/v1/products',
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'V1 Product resources routing' do
RSpec.describe 'V1 Product resources routing', type: :routing do
it 'routes /products' do
expect(get '/products').to route_to(
controller: 'api/v1/products',
@@ -1,6 +1,6 @@
require 'spec_helper'
require 'rails_helper'

describe 'V1 Store resources routing' do
RSpec.describe 'V1 Store resources routing', type: :routing do
it 'routes /stores' do
expect(get '/stores').to route_to(
controller: 'api/v1/stores',
@@ -1,21 +1,76 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'fabrication'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause this
# file to always be loaded, without a need to explicitly require it in any files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, make a
# separate helper file that requires this one and then use it only in the specs
# that actually need it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
# config.filter_run :focus
# config.run_all_when_everything_filtered = true

# 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 }
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
# if config.files_to_run.one?
# # Use the documentation formatter for detailed output,
# # unless a formatter has already been configured
# # (e.g. via a command-line flag).
# config.default_formatter = 'doc'
# end

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
# config.profile_examples = 10

RSpec.configure do |config|
config.order = 'random'
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
# 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

# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed

# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
# config.expect_with :rspec do |expectations|
# # Enable only the newer, non-monkey-patching expect syntax.
# # For more details, see:
# # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
# expectations.syntax = :expect
# end

# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
# config.mock_with :rspec do |mocks|
# # Enable only the newer, non-monkey-patching expect syntax.
# # For more details, see:
# # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# mocks.syntax = :expect

config.include SpecHelpers
# # Prevents you from mocking or stubbing a method that does not exist on
# # a real object. This is generally recommended.
# mocks.verify_partial_doubles = true
# end
end

This file was deleted.

Oops, something went wrong.

0 comments on commit 829911b

Please sign in to comment.