Skip to content

Instantly share code, notes, and snippets.

View ch1ago's full-sized avatar
🏠
Working mostly from home since 2006

Thiago Almeida ch1ago

🏠
Working mostly from home since 2006
  • Mexico City
  • 22:51 (UTC -06:00)
View GitHub Profile
this page https://github.com/rspec/rspec-rails
tells me to do this...
describe "events/show" do
it "displays the event location" do
assign(:event, stub_model(Event,
:location => "Chicago"
))
render
rendered.should contain("Chicago")
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
require 'spec_helper'
describe "Session" do
describe "GET /auth/facebook and /session/create (same as /auth/facebook/callback)" do
it "triggers callback, creates Bob and redirects to root" do
expect do
get '/auth/facebook'
end.to change(User, :count).by(1) && change(Login, :count).by(1)
response.status.should be(200)
Failed examples:
rspec ./spec/controllers/users_controller_spec.rb:96 # UsersController POST create with invalid params re-renders the 'new' template
rspec ./spec/controllers/users_controller_spec.rb:139 # UsersController PUT update with invalid params re-renders the 'edit' template
Running: spec/controllers/users_controller_spec.rb spec/routing/users_routing_spec.rb
........F....F.........
Failures:
1) UsersController POST create with invalid params re-renders the 'new' template
GIT
remote: git://github.com/tchandy/octopus.git
revision: f3410d73889469a1456dc0c72b7f6942653e2d31
specs:
ar-octopus (0.4.0)
activerecord (>= 2.3.0)
GEM
remote: http://rubygems.org/
specs:
require 'spec_helper'
describe "bands/show" do
before(:each) do
@band = assign(:band, Fabricate(:band))
end
it "renders page" do
render
end
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
can :read, Band
can :create, Band do |band|
user.persisted?
end
Fabricator(:state) do
name { Faker::Address.city }
end
Fabricator(:city) do
state #{ Fabricate(:state) }
name { Faker::Address.city }
end
Failures:
1) SessionsController GET 'destroy' returns http success
Failure/Error: get 'destroy'
NameError:
undefined local variable or method `root_path' for #<SessionsController:0x9c8a088>
# ./app/controllers/sessions_controller.rb:20:in `destroy'
# ./spec/controllers/sessions_controller_spec.rb:18:in `block (3 levels) in <top (required)>'
2) users/index renders a list of users
SELECT `sales`.* FROM `sales`
INNER JOIN `properties` ON `properties`.`id` = `sales`.`property_id`
WHERE (properties.zip = 33160)
ORDER BY sale_date DESC
LIMIT 10
Duration 56,163 ms
Explain