[rspec-users] Specs for ApplicationController, where to put them?
Wincent Colaiuta
win at wincent.com
Thu May 31 10:42:06 EDT 2007
El 31/5/2007, a las 12:46, David Chelimsky escribió:
>> Index: rspec/lib/spec/dsl/behaviour.rb
>> ===================================================================
>> --- rspec/lib/spec/dsl/behaviour.rb (revision 2061)
>> +++ rspec/lib/spec/dsl/behaviour.rb (working copy)
>> @@ -7,6 +7,7 @@
>> class << self
>> def add_shared_behaviour(behaviour)
>> return if behaviour.equal?(found_behaviour =
>> find_shared_behaviour(behaviour.description))
>> + return if found_behaviour and behaviour.description
>> [:spec_path] == found_behaviour.description[:spec_path]
>> raise ArgumentError.new("Shared Behaviour '#
>> {behaviour.description}' already exists") if found_behaviour
>> shared_behaviours << behaviour
>> end
>> Index: rspec/spec/spec/dsl/shared_behaviour_spec.rb
>> ===================================================================
>> --- rspec/spec/spec/dsl/shared_behaviour_spec.rb (revision
>> 2061)
>> +++ rspec/spec/spec/dsl/shared_behaviour_spec.rb (working
>> copy)
>> @@ -74,16 +74,23 @@
>> end
>> it "should complain when adding a second shared behaviour
>> with the same description" do
>> - make_shared_behaviour("shared behaviour") {}
>> - lambda { make_shared_behaviour("shared behaviour")
>> {} }.should raise_error(ArgumentError)
>> + describe "shared behaviour", :shared => true do
>> + end
>> + lambda { describe "shared behaviour", :shared => true do
>> + end }.should raise_error(ArgumentError)
>> end
>> - it "should NOT complain when adding a the same shared
>> behaviour again (i.e. file gets reloaded)" do
>> - behaviour = behaviour_class.new("shared behaviour") {}
>> - behaviour_class.add_shared_behaviour(behaviour)
>> - behaviour_class.add_shared_behaviour(behaviour)
>> + it "should NOT complain when adding the same shared behaviour
>> instance again" do
>> + shared_behaviour = make_shared_behaviour("shared
>> behaviour") {}
>> + behaviour_class.add_shared_behaviour(shared_behaviour)
>> + behaviour_class.add_shared_behaviour(shared_behaviour)
>> end
>> + it "should NOT complain when adding the same shared behaviour
>> again (i.e. file gets reloaded)" do
>> + lambda { 2.times { describe "shared behaviour", :shared =>
>> true do
>> + end } }.should_not raise_error(ArgumentError)
>> + end
>> +
>> it "should add examples to current behaviour when calling
>> it_should_behave_like" do
>> shared_behaviour = make_shared_behaviour("shared
>> behaviour") {}
>> shared_behaviour.it("shared example") {}
>
> Please post this in the tracker:
> http://rubyforge.org/tracker/?atid=3151&group_id=797&func=browse.
Ok, done:
http://rubyforge.org/tracker/index.php?
func=detail&aid=11252&group_id=797&atid=3151
Cheers,
Wincent
More information about the rspec-users
mailing list