Skip to content

Instantly share code, notes, and snippets.

View dchelimsky's full-sized avatar

David Chelimsky dchelimsky

  • Retired
  • Chicago, IL, USA
View GitHub Profile
require 'rubygems'
require 'synthesis/task'
Synthesis::Task.new do |t|
t.adapter = :rspec
t.pattern = '**/*.rb'
end
@dchelimsky
dchelimsky / gist:24369
Created November 13, 2008 05:04 — forked from dkubb/gist:5524
resource 'posts/:id' do |id|
get do
# show post id
end
delete do
# destroy post id
end
get :comments do
describe 'A Collection' do
subject { Collection.new }
action { clear }
should_return_self
should_clear_itself
end
def find(conditions)
conditions.each_pair do |k,v|
...
end
end
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:
(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"
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
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
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!
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