Skip to content

Instantly share code, notes, and snippets.

@ivanoats
Created November 22, 2011 22:52
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 ivanoats/1387312 to your computer and use it in GitHub Desktop.
Save ivanoats/1387312 to your computer and use it in GitHub Desktop.
basic controller test
require 'spec_helper'
describe TechnologiesController do
describe "GET show" do
let(:technology) { mock_model(Technology, id: 1) }
it "shows a technology" do
get :show, :id => 1
response.should be_success
end
it "shows the technology template" do
get :show, id: 1
response.should render_template("show")
end
end
it "shows a list of technologies" do
get "index"
end
end
@ivanoats
Copy link
Author

@ivanoats
Copy link
Author

adding

    before :each do
      Technology.stub(:find).with("1").and_return(@technology)
    end

works!

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