This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gemfile | |
source 'http://rubygems.org' | |
gem 'acts_as_list', '0.1.2' | |
gem 'acts_as_singleton', :git => 'git://github.com/stephencelis/acts_as_singleton.git' | |
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3' | |
gem 'aws-s3', '0.6.2' | |
gem 'cancan', '1.1.1' | |
gem 'delayed_job', '2.0.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/features/view_specs/view_spec.feature b/features/view_specs/view_spec.feature | |
index e85c306..6534c30 100644 | |
--- a/features/view_specs/view_spec.feature | |
+++ b/features/view_specs/view_spec.feature | |
@@ -152,3 +152,34 @@ Feature: view spec | |
""" | |
When I run "rspec spec/views" | |
Then the output should contain "1 example, 0 failures" | |
+ | |
+ Scenario: spec with view that accesses helper_method helpers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shared_examples_for "a measurable object" do |measurement_method, measurement| | |
it "should return #{measurement} from ##{measurement_method}" do | |
subject.send(measurement_method).should == measurement | |
end | |
end | |
describe Array do | |
it_should_behave_like "a measurable object", :size, 2 do | |
subject { [2, 13] } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassProjectsController < ApplicationController | |
def new | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe SomeClass do | |
freeze { 1.day.from_now } | |
it "does some stuff with time" do | |
end | |
end | |
# this actually does... | |
describe SomeClass do | |
around { |example| Timecop.freeze(1.day.from_now, &example) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RSpec Mocks... | |
it "does something with a collaborator" do | |
#Given | |
collab = mock(:collab) | |
it.collaborator = collab | |
#Then | |
collab.should_receive(:call).with(3) | |
#When |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RSpec Mocks... | |
it "does something with a collaborator" do | |
#Given | |
collab = mock(:collab) | |
it.collaborator = collab | |
#Then | |
collab.should_receive(:call).with(3) | |
#When |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Controller do | |
context "create" do | |
it "saves the model" do | |
model = Model.new | |
Model.stub(:new).and_return(model) | |
model.should_receive(:save) | |
post :create | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyModule | |
def some_method | |
super | |
rescue SystemStackError => e | |
puts "you're including MyModule more than once" | |
end | |
end | |
class MyBaseClass; end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe ArticlesController, :type => :controller do | |
# ^^ :type => :controller is not necessary if the file is in spec/controllers | |
describe "GET index" do | |
# ^^ The describe method creates an example group. ^^ | |
get :index | |
# ^^ The get method is exposed to an example. | |
response.should be_successful | |
end |