Skip to content

Instantly share code, notes, and snippets.

@thoraxe
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoraxe/9753776 to your computer and use it in GitHub Desktop.
Save thoraxe/9753776 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe FilesController do
describe 'PUT files' do
context "when the id hasn't been pre-created" do
before { put :files, :id => "doesn't exist" }
expect(response.response_code).to eq(Rack::Utils::SYMBOL_TO_STATUS_CODE[:unprocessable_entity])
end
end
end
source 'https://rubygems.org'
gem 'rails', '~> 3.2.16'
gem 'rack', '~> 1.4.5'
gem 'redis'
gem 'redis-objects'
gem 'therubyracer'
gem 'haml'
group :production, :mysql do
gem 'mysql2'
end
group :production, :postgresql do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
gem 'minitest'
gem 'thor', '= 0.14.6'
gem 'rspec-rails'
gem 'capybara'
gem "faker"
gem "factory_girl_rails"
gem "shoulda-matchers"
end
group :test do
gem 'database_cleaner'
end
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
bundle exec rspec spec/controllers/files_controller_spec.rb
MiniTest::Unit::TestCase is now Minitest::Test. From /usr/share/ruby/test/unit/testcase.rb:8:in `<module:Unit>'
MiniTest::Unit::TestCase is now Minitest::Test. From /home/thoraxe/.gem/ruby/gems/activesupport-3.2.16/lib/active_support/test_case.rb:12:in `<module:ActiveSupport>'
MiniTest::Unit::TestCase is now Minitest::Test. From /home/thoraxe/.gem/ruby/gems/activesupport-3.2.16/lib/active_support/descendants_tracker.rb:34:in `inherited'
MiniTest::Unit::TestCase is now Minitest::Test. From /home/thoraxe/.gem/ruby/gems/activesupport-3.2.16/lib/active_support/descendants_tracker.rb:34:in `inherited'
MiniTest::Unit::TestCase is now Minitest::Test. From /home/thoraxe/.gem/ruby/gems/activesupport-3.2.16/lib/active_support/descendants_tracker.rb:34:in `inherited'
MiniTest::Unit::TestCase is now Minitest::Test. From /home/thoraxe/.gem/ruby/gems/activesupport-3.2.16/lib/active_support/descendants_tracker.rb:34:in `inherited'
/home/thoraxe/Documents/crypto/spec/controllers/files_controller_spec.rb:9:in `block (3 levels) in <top (required)>': undefined local variable or method `response' for #<Class:0x000000046f98d0> (NameError)
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
from /home/thoraxe/Documents/crypto/spec/controllers/files_controller_spec.rb:6:in `block (2 levels) in <top (required)>'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
from /home/thoraxe/Documents/crypto/spec/controllers/files_controller_spec.rb:5:in `block in <top (required)>'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `module_eval'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:246:in `subclass'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:232:in `describe'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/dsl.rb:18:in `describe'
from /home/thoraxe/Documents/crypto/spec/controllers/files_controller_spec.rb:3:in `<top (required)>'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
from /home/thoraxe/.gem/ruby/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
@lengarvey
Copy link

require 'spec_helper'

describe FilesController do

  describe 'PUT files' do
    context "when the id hasn't been pre-created" do
      before { put :files, :id => "doesn't exist" }

      it 'needs a example block in order to be a valid spec' dp
        expect(response.response_code).to eq(Rack::Utils::SYMBOL_TO_STATUS_CODE[:unprocessable_entity])
      end
    end
  end

end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment