Permalink
Browse files

Eliminate the remaining warnings emitted by rspec-core.

There are still some emitted by upstream dependencies.

- Closes #488.
  • Loading branch information...
1 parent e3c842b commit 648b344d86b1660bd2e60261a588256f2764d8ef @mvz mvz committed with dchelimsky Oct 30, 2011
View
@@ -27,7 +27,7 @@ Cucumber::Rake::Task.new(:cucumber)
desc "Run non-ui examples"
RSpec::Core::RakeTask.new(:spec) do |t|
- t.ruby_opts = '-w'
+ t.ruby_opts = %w[-w]
end
namespace :spec do
@@ -8,7 +8,7 @@ class NullConverter; def convert(code, pre); code; end; end
begin
require 'syntax/convertors/html'
@@converter = Syntax::Convertors::HTML.for_syntax "ruby"
- rescue LoadError => e
+ rescue LoadError
@@converter = NullConverter.new
end
@@ -3,7 +3,7 @@
describe "failed_results_re for autotest" do
def run_example
group = RSpec::Core::ExampleGroup.describe("group")
- example = group.example("example") { yield }
+ group.example("example") { yield }
io = StringIO.new
formatter = RSpec::Core::Formatters::BaseTextFormatter.new(io)
reporter = RSpec::Core::Reporter.new(formatter)
@@ -181,7 +181,6 @@ module RSpec::Core
context "with default pattern" do
it "loads files named _spec.rb" do
- dir = "spec/rspec/core/resources"
config.files_or_directories_to_run = "spec/rspec/core/resources"
config.files_to_run.should eq([ "spec/rspec/core/resources/a_spec.rb"])
end
@@ -799,7 +798,9 @@ def metadata_hash(*args)
describe "#add_setting" do
describe "with no modifiers" do
context "with no additional options" do
- before { config.add_setting :custom_option }
+ before do
+ config.add_setting :custom_option
+ end
it "defaults to nil" do
config.custom_option.should be_nil
@@ -816,7 +817,9 @@ def metadata_hash(*args)
end
context "with :default => 'a value'" do
- before { config.add_setting :custom_option, :default => 'a value' }
+ before do
+ config.add_setting :custom_option, :default => 'a value'
+ end
it "defaults to 'a value'" do
config.custom_option.should eq("a value")
@@ -921,6 +924,13 @@ def self.included(host)
describe "#alias_example_to" do
it_behaves_like "metadata hash builder" do
+ after do
+ RSpec::Core::ExampleGroup.module_eval do
+ class << self
+ undef :my_example_method if method_defined? :my_example_method
+ end
+ end
+ end
def metadata_hash(*args)
config.alias_example_to :my_example_method, *args
group = ExampleGroup.describe("group")
@@ -111,7 +111,7 @@ def metadata_hash(*args)
world = RSpec::Core::World.new
parent = ExampleGroup.describe
world.register(parent)
- child = parent.describe
+ parent.describe
world.example_groups.should eq([parent])
end
end
@@ -149,15 +149,15 @@ def metadata_hash(*args)
it "excludes examples in groups matching filter" do
group = ExampleGroup.describe("does something", spec_metadata)
group.stub(:world) { world }
- all_examples = [ group.example("first"), group.example("second") ]
+ [ group.example("first"), group.example("second") ]
group.filtered_examples.should be_empty
end
it "excludes examples directly matching filter" do
group = ExampleGroup.describe("does something")
group.stub(:world) { world }
- filtered_examples = [
+ [
group.example("first", spec_metadata),
group.example("second", spec_metadata)
]
@@ -248,7 +248,7 @@ def metadata_hash(*args)
world.stub(:inclusion_filter).and_return({ :awesome => false })
group = ExampleGroup.describe
group.stub(:world) { world }
- example = group.example("does something")
+ group.example("does something")
group.filtered_examples.should eq([])
end
end
@@ -1008,7 +1008,7 @@ def foo; end
eval_count = 0
shared_examples_for("thing") { |p| eval_count += 1 }
group = ExampleGroup.describe('fake group')
- shared_group = group.it_should_behave_like("thing", :a)
+ group.it_should_behave_like("thing", :a)
eval_count.should eq(1)
end
end
@@ -2,7 +2,7 @@
require 'rspec/core/formatters/helpers'
describe RSpec::Core::Formatters::Helpers do
- let(:helper) { helper = Object.new.extend(RSpec::Core::Formatters::Helpers) }
+ let(:helper) { Object.new.extend(RSpec::Core::Formatters::Helpers) }
describe "format seconds" do
context "sub second times" do
@@ -49,7 +49,7 @@ module Formatters
end
def extract_backtrace_from(doc)
- backtrace = doc.search("div.backtrace").
+ doc.search("div.backtrace").
collect {|e| e.at("pre").inner_html}.
collect {|e| e.split("\n")}.flatten.
select {|e| e =~ /formatter_specs\.rb/}
@@ -72,6 +72,7 @@ def extract_backtrace_from(doc)
actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
File.expand_path(actual_path).should eq(File.expand_path(expected_path))
actual_line_number.should eq(expected_line_number)
+ actual_suffix.should eq(expected_suffix)
end
end
end
@@ -48,7 +48,6 @@
%w[describe context].each do |method_name|
it "supports nested example groups using #{method_name}" do
- whatever = nil
shared = Module.new do
extend RSpec::SharedContext
send(method_name, "nested using describe") do
@@ -152,7 +152,7 @@ def name
its([:a]) { should eq("Symbol: a") }
its(['a']) { should eq("String: a") }
its([:b, 'c', 4]) { should eq("Symbol: b; String: c; Fixnum: 4") }
- its(:name) { should = "George" }
+ its(:name) { should eq("George") }
context "when referring to an attribute without the proper array syntax" do
context "it raises an error" do
its(:age) do

0 comments on commit 648b344

Please sign in to comment.