Sha256: 820386908eae6c84f51134dfc9ca6e054cabdfc7b3297ac823b0ad3f7990ac37

Contents?: true

Size: 801 Bytes

Versions: 13

Compression:

Stored size: 801 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

module SharedBehaviourExample
  class OneThing
    def what_things_do
      "stuff"
    end
  end
  
  class AnotherThing
    def what_things_do
      "stuff"
    end
  end
  
  describe "All Things", :shared => true do
    def helper_method
      "helper method"
    end
    
    it "should do what things do" do
      @thing.what_things_do.should == "stuff"
    end
  end

  describe OneThing do
    it_should_behave_like "All Things"
    before(:each) { @thing = OneThing.new }
    
    it "should have access to helper methods defined in the shared behaviour" do
      helper_method.should == "helper method"
    end
  end

  describe AnotherThing do
    it_should_behave_like "All Things"
    before(:each) { @thing = AnotherThing.new }
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
deckshuffler-0.0.2 vendor/plugins/rspec/examples/shared_behaviours_example.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/examples/shared_behaviours_example.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/examples/shared_behaviours_example.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/examples/shared_behaviours_example.rb
rspec-1.0.1 examples/shared_behaviours_example.rb
rspec-1.0.0 examples/shared_behaviours_example.rb
rspec-1.0.3 examples/shared_behaviours_example.rb
rspec-1.0.4 examples/shared_behaviours_example.rb
rspec-1.0.5 examples/shared_behaviours_example.rb
rspec-1.0.2 examples/shared_behaviours_example.rb
rspec-1.0.7 examples/shared_behaviours_example.rb
rspec-1.0.6 examples/shared_behaviours_example.rb
rspec-1.0.8 examples/shared_behaviours_example.rb