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 'matchers.rb' | |
describe CheckOut do | |
let(:checkout) { CheckOut.new(RULES) } | |
context "calculating totals" do | |
subject { checkout } | |
it { should price("").at(0) } | |
it { should price("A").at(50) } |
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 CapybaraStringMatchers | |
extend RSpec::Matchers::DSL | |
matcher :have_selector do |selector| | |
match do |html| | |
simplified(html).has_selector?(selector) | |
end | |
failure_message_for_should do |html| | |
"expected to find selector #{selector.inspect} in:\n#{html.to_s}" |
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
# if you're converting a stock rails test/unit suite to rspec-2, this little business can help | |
module TestToSpec | |
def self.included(includer) | |
includer.class_eval do | |
def test(*args, &block) | |
example(*args, &block) | |
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
$ be cucumber features/subject/attribute_of_subject.feature:104 --format pretty | |
Using the default profile... | |
Feature: attribute of subject | |
Use the its() method as a short-hand to generate a nested example group with | |
a single example that specifies the expected value of an attribute of the | |
subject. This can be used with an implicit or explicit subject. | |
its() accepts a symbol or a string, and a block representing the example. | |
its(:size) { should eq(1) } |
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/spec/autotest/failed_results_re_spec.rb b/spec/autotest/failed_results_re_spec.rb | |
index ea04333..a536c9c 100644 | |
--- a/spec/autotest/failed_results_re_spec.rb | |
+++ b/spec/autotest/failed_results_re_spec.rb | |
@@ -18,6 +18,11 @@ describe "failed_results_re for autotest" do | |
it "matches a failure" do | |
re = Autotest::Rspec2.new.failed_results_re | |
+ puts "*"*50 | |
+ p re |
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
$ rvm -v | |
rvm 1.2.7 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
$ gem -v | |
1.5.2 | |
$ gem list | |
*** LOCAL GEMS *** |
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 |
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
# ------------------------------------- | |
# DECLARATION | |
# using strings for explicit inclusion | |
shared 'logged in as admin' do | |
before { login_as admin_user } | |
end | |
shared 'a model with a slug' do | |
it 'sets the slug column upon initialization' do |