#spec/controllers/foo_controller_spec.rb
describe FooController
it “magically has get and assigns methods????”
get :index
expect(assigns[:foo]).to be true
end
end
Slide 61
Slide 61 text
#spec/controllers/foo_controller_spec.rb
describe FooController, :type => :controller
it “gets the methods from the metadata”
get :index
expect(assigns[:foo]).to be true
end
end
Slide 62
Slide 62 text
This applies to all Rails
spec types
Slide 63
Slide 63 text
You can structure your
specs however you like
Slide 64
Slide 64 text
If you badly need
directory based spec
inference
Slide 65
Slide 65 text
RSpec.configure do |config|
config.infer_spec_type_from_file_location!
end
Slide 66
Slide 66 text
http://tinyurl.com/kgllgtb
Slide 67
Slide 67 text
RSpec is trying to get less
bad at patching methods
on to everything for you
Slide 68
Slide 68 text
Sytnax
Slide 69
Slide 69 text
The “a.should == b”
syntax is not gone
Slide 70
Slide 70 text
It is deprecated
Slide 71
Slide 71 text
I strongly advise you to
use expect(a).to eq(b)
everywhere