Skip to content

Commit

Permalink
Strings and Symbols are ignored as described class.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jun 24, 2010
1 parent 16d0e4a commit 3694c51
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion lib/rspec/core/metadata.rb
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions rspec-core.gemspec
Expand Up @@ -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"]
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"])
Expand Down
17 changes: 17 additions & 0 deletions spec/rspec/core/example_group_spec.rb
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions spec/rspec/core/metadata_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3694c51

Please sign in to comment.