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 'rubygems' | |
require 'synthesis/task' | |
Synthesis::Task.new do |t| | |
t.adapter = :rspec | |
t.pattern = '**/*.rb' | |
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
resource 'posts/:id' do |id| | |
get do | |
# show post id | |
end | |
delete do | |
# destroy post id | |
end | |
get :comments do |
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 'A Collection' do | |
subject { Collection.new } | |
action { clear } | |
should_return_self | |
should_clear_itself | |
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
def find(conditions) | |
conditions.each_pair do |k,v| | |
... | |
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
1) | |
ArgumentError in 'send_email behaviour_type should pass otherwise' | |
wrong number of arguments (1 for 0) | |
./vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb:666: | |
2) | |
ArgumentError in 'send_email behaviour_type should fail with nothing sent' | |
wrong number of arguments (1 for 0) | |
./vendor/plugins/rspec-rails/spec/rails/matchers/assert_select_spec.rb:658: | |
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 stack | |
("without arguments returns 0" | |
(should = (+) 0)) | |
("with a single argument returns the argument" | |
(should = 1 (+ 1)) | |
(should = 1337 (+ 1337))) | |
("with multiple arguments returns the sum of the arguments" |
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
template = mock('template') | |
template.should_receive(:update_attributes!) | |
Template.should_receive(:find).with("37").and_return(template) | |
@response = request(resource(template), :method => "PUT") # raises Resource route not found: [#<Spec::Mocks::Mock:0x110e5cc @name="template">] | |
@response = request("/admin/templates/37", :method => "PUT") # passes |
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 "successful PUT" do | |
it "should be successful" do | |
template = savable(Template) | |
@response = request(resource(template), :method => "PUT") | |
@response.should be_successful | |
end | |
end | |
describe "unsuccessful PUT" do | |
it "should be successful" do |
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
def should_assign_attachment_named(name) | |
it "should allow the assignment of #{name}" do | |
@attachment_model.__send__("#{name}=") = dummy_file | |
@attachment_model.should be_valid | |
@attachment_model.should have(:no).errors | |
end | |
it 'should save the #{name} when the model is saved' do | |
@attachment_model.__send__(name).should_receive(:save).once.and_return(true) | |
@attachment_model.save! |
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
before :each do | |
@mock_browser = mock("@browser") | |
@mock_browser.stub!(:type) | |
@mock_browser.stub!(:select) | |
@builder = Company::Selenium::Builders::BillingAddress.new(@mock_browser) | |
@builder.stub!(:browser).and_return(@mock_browser) | |
end | |
it "sends instruction for BillName" do | |
@mock_browser.should_receive(:send).with(:type, "BillName", "Bob Dole").once |