Skip to content
Browse files

even cleaner (better message and more signal in spec)

- #432.
  • Loading branch information...
1 parent ea7351c commit 3f27e7a9c32475ee8621f048fe237a6f8ab071e3 @dchelimsky dchelimsky committed Aug 4, 2011
Showing with 5 additions and 10 deletions.
  1. +1 −1 lib/rspec/core/example_group.rb
  2. +4 −9 spec/rspec/core/example_group_spec.rb
View
2 lib/rspec/core/example_group.rb
@@ -93,7 +93,7 @@ def self.include_context(name)
if world.shared_example_groups.has_key?(name)
module_eval(&world.shared_example_groups[name])
else
- raise ArgumentError, "shared context \"#{name}\" not found"
+ raise ArgumentError, "could not find shared context #{name.inspect}"
end
end
View
13 spec/rspec/core/example_group_spec.rb
@@ -889,18 +889,13 @@ def foo; 'foo'; end
group.run.should be_true
end
- it "raises a friendly error message when shared context is not found" do
+ it "raises a helpful error message when shared context is not found" do
expect do
- group = ExampleGroup.describe do
- include_context "not exist"
-
- it "accesses foo" do
- foo.should eq('foo')
- end
+ ExampleGroup.describe do
+ include_context "shared stuff"
end
- end.to raise_error(ArgumentError,'shared context "not exist" not found')
+ end.to raise_error(ArgumentError,%q|could not find shared context "shared stuff"|)
end
-
end
describe "#include_examples" do

0 comments on commit 3f27e7a

Please sign in to comment.
Something went wrong with that request. Please try again.