Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Strings and Symbols are ignored as described class.

  • Loading branch information...
commit 3694c5149874d59e2b79e9657a6547d3b12fb7d8 1 parent 16d0e4a
@dchelimsky dchelimsky authored
View
1  Gemfile
@@ -11,3 +11,4 @@ gem "flexmock"
gem "rspec-core", :path => "."
gem "rspec-expectations", :path => "../rspec-expectations"
gem "rspec-mocks", :path => "../rspec-mocks"
+gem "ruby-debug"
View
2  lib/rspec/core/metadata.rb
@@ -139,7 +139,7 @@ def full_description_from(args)
end
def described_class_from(args)
- if args.first.is_a?(String)
+ if args.first.is_a?(String) || args.first.is_a?(Symbol)
superclass_metadata[:example_group][:describes]
else
args.first
View
6 rspec-core.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Chad Humphries", "David Chelimsky"]
- s.date = %q{2010-06-21}
+ s.date = %q{2010-06-22}
s.description = %q{RSpec runner and example groups}
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
s.executables = ["rspec", "spec"]
@@ -141,7 +141,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{rspec}
- s.rubygems_version = %q{1.3.6}
+ s.rubygems_version = %q{1.3.7}
s.summary = %q{rspec-core-2.0.0.beta.12}
s.test_files = [
"spec/autotest/failed_results_re_spec.rb",
@@ -184,7 +184,7 @@ Gem::Specification.new do |s|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.beta.12"])
s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.beta.12"])
s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
View
17 spec/rspec/core/example_group_spec.rb
@@ -127,6 +127,23 @@ module RSpec::Core
end
end
+ context "with a constant in an outer group" do
+ context "and a string in an inner group" do
+ it "is the top level constant" do
+ group = ExampleGroup.describe(String) do
+ describe :symbol do
+ example "describes is String" do
+ debugger
+ described_class.should eq(String)
+ end
+ end
+ end
+
+ group.run_all.should be_true
+ end
+ end
+ end
+
end
describe '#description' do
View
32 spec/rspec/core/metadata_spec.rb
@@ -25,6 +25,38 @@ module Core
end
end
+ describe "describes" do
+ context "with a String" do
+ it "returns nil" do
+ m = Metadata.new
+ m.process('group')
+
+ m = m.for_example("example", {})
+ m[:example_group][:describes].should be_nil
+ end
+ end
+
+ context "with a Symbol" do
+ it "returns nil" do
+ m = Metadata.new
+ m.process(:group)
+
+ m = m.for_example("example", {})
+ m[:example_group][:describes].should be_nil
+ end
+ end
+
+ context "with a class" do
+ it "returns the class" do
+ m = Metadata.new
+ m.process(String)
+
+ m = m.for_example("example", {})
+ m[:example_group][:describes].should be(String)
+ end
+ end
+ end
+
describe "full description" do
it "concats the example group name and description" do
m = Metadata.new
Please sign in to comment.
Something went wrong with that request. Please try again.