Permalink
Browse files

Replace before(:each) with before

  • Loading branch information...
1 parent e60e01c commit 509b87bcf168a713815e586c048e2e1e1ac5e896 @sferik sferik committed May 6, 2012
View
6 spec/actions/create_file_spec.rb
@@ -2,7 +2,7 @@
require 'thor/actions'
describe Thor::Actions::CreateFile do
- before(:each) do
+ before do
::FileUtils.rm_rf(destination_root)
end
@@ -63,7 +63,7 @@ def silence!
end
describe "when file exists" do
- before(:each) do
+ before do
create_file("doc/config.rb")
invoke!
end
@@ -77,7 +77,7 @@ def silence!
end
describe "and is not identical" do
- before(:each) do
+ before do
File.open(File.join(destination_root, 'doc/config.rb'), 'w'){ |f| f.write("FOO = 3") }
end
View
2 spec/actions/create_link_spec.rb
@@ -3,7 +3,7 @@
require 'tempfile'
describe Thor::Actions::CreateLink do
- before(:each) do
+ before do
@hardlink_to = File.join(Dir.tmpdir, 'linkdest.rb')
::FileUtils.rm_rf(destination_root)
::FileUtils.rm_rf(@hardlink_to)
View
2 spec/actions/directory_spec.rb
@@ -2,7 +2,7 @@
require 'thor/actions'
describe Thor::Actions::Directory do
- before(:each) do
+ before do
::FileUtils.rm_rf(destination_root)
invoker.stub!(:file_name).and_return("rdoc")
end
View
4 spec/actions/empty_directory_spec.rb
@@ -2,7 +2,7 @@
require 'thor/actions'
describe Thor::Actions::EmptyDirectory do
- before(:each) do
+ before do
::FileUtils.rm_rf(destination_root)
end
@@ -98,7 +98,7 @@ def base
context "protected methods" do
describe "#convert_encoded_instructions" do
- before :each do
+ before do
empty_directory("test_dir")
@action.base.stub!(:file_name).and_return("expected")
end
View
6 spec/actions/file_manipulation_spec.rb
@@ -23,7 +23,7 @@ def file
File.join(destination_root, "foo")
end
- before(:each) do
+ before do
::FileUtils.rm_rf(destination_root)
end
@@ -197,7 +197,7 @@ def file
end
describe "when changing existent files" do
- before(:each) do
+ before do
::FileUtils.cp_r(source_root, destination_root)
end
@@ -316,7 +316,7 @@ def file
end
describe "when adjusting comments" do
- before(:each) do
+ before do
::FileUtils.cp_r(source_root, destination_root)
end
View
2 spec/actions/inject_into_file_spec.rb
@@ -2,7 +2,7 @@
require 'thor/actions'
describe Thor::Actions::InjectIntoFile do
- before(:each) do
+ before do
::FileUtils.rm_rf(destination_root)
::FileUtils.cp_r(source_root, destination_root)
end
View
6 spec/actions_spec.rb
@@ -198,7 +198,7 @@ def file
end
describe "#apply" do
- before(:each) do
+ before do
@template = <<-TEMPLATE
@foo = "FOO"
say_status :cool, :padding
@@ -248,7 +248,7 @@ def file
end
describe "#run" do
- before(:each) do
+ before do
runner.should_receive(:system).with("ls")
end
@@ -271,7 +271,7 @@ def file
end
describe "#run_ruby_script" do
- before(:each) do
+ before do
Thor::Util.stub!(:ruby_command).and_return("/opt/jruby")
runner.should_receive(:system).with("/opt/jruby script.rb")
end
View
2 spec/base_spec.rb
@@ -104,7 +104,7 @@ def hello
end
describe "#class_options_help" do
- before(:each) do
+ before do
@content = capture(:stdout) { MyCounter.help(Thor::Base.shell.new) }
end
View
2 spec/core_ext/hash_with_indifferent_access_spec.rb
@@ -2,7 +2,7 @@
require 'thor/core_ext/hash_with_indifferent_access'
describe Thor::CoreExt::HashWithIndifferentAccess do
- before(:each) do
+ before do
@hash = Thor::CoreExt::HashWithIndifferentAccess.new :foo => 'bar', 'baz' => 'bee', :force => true
end
View
4 spec/core_ext/ordered_hash_spec.rb
@@ -2,7 +2,7 @@
require 'thor/core_ext/ordered_hash'
describe Thor::CoreExt::OrderedHash do
- before :each do
+ before do
@hash = Thor::CoreExt::OrderedHash.new
end
@@ -26,7 +26,7 @@
end
describe "with several items" do
- before :each do
+ before do
@hash[:foo] = "Foo!"
@hash[:bar] = "Bar!"
@hash[:baz] = "Baz!"
View
8 spec/group_spec.rb
@@ -56,7 +56,7 @@
end
describe "#help" do
- before(:each) do
+ before do
@content = capture(:stdout){ MyCounter.help(Thor::Base.shell.new) }
end
@@ -76,7 +76,7 @@
end
describe "#invoke" do
- before(:each) do
+ before do
@content = capture(:stdout){ E.start }
end
@@ -108,7 +108,7 @@
describe "#invoke_from_option" do
describe "with default type" do
- before(:each) do
+ before do
@content = capture(:stdout){ G.start }
end
@@ -147,7 +147,7 @@
end
describe "with boolean type" do
- before(:each) do
+ before do
@content = capture(:stdout){ H.start }
end
View
12 spec/parser/options_spec.rb
@@ -151,7 +151,7 @@ def check_unknown!
end
describe "with one required and one optional switch" do
- before :each do
+ before do
create "--foo" => :required, "--bar" => :boolean
end
@@ -174,7 +174,7 @@ def check_unknown!
end
describe "with :string type" do
- before(:each) do
+ before do
create ["--foo", "-f"] => :required
end
@@ -220,7 +220,7 @@ def check_unknown!
end
describe "with :boolean type" do
- before(:each) do
+ before do
create "--foo" => false
end
@@ -271,7 +271,7 @@ def check_unknown!
end
describe "with :hash type" do
- before(:each) do
+ before do
create "--attributes" => :hash
end
@@ -289,7 +289,7 @@ def check_unknown!
end
describe "with :array type" do
- before(:each) do
+ before do
create "--attributes" => :array
end
@@ -307,7 +307,7 @@ def check_unknown!
end
describe "with :numeric type" do
- before(:each) do
+ before do
create "n" => :numeric, "m" => 5
end
View
8 spec/runner_spec.rb
@@ -117,7 +117,7 @@ def when_no_thorfiles_exist
end
describe "tasks" do
- before(:each) do
+ before do
@location = "#{File.dirname(__FILE__)}/fixtures/task.thor"
@original_yaml = {
"random" => {
@@ -190,7 +190,7 @@ def when_no_thorfiles_exist
end
describe "uninstall" do
- before(:each) do
+ before do
path = File.join(Thor::Util.thor_root, @original_yaml["random"][:filename])
FileUtils.should_receive(:rm_rf).with(path)
end
@@ -201,7 +201,7 @@ def when_no_thorfiles_exist
end
describe "installed" do
- before(:each) do
+ before do
Dir.should_receive(:[]).and_return([])
end
@@ -213,7 +213,7 @@ def when_no_thorfiles_exist
end
describe "install/update" do
- before(:each) do
+ before do
FileUtils.stub!(:mkdir_p)
FileUtils.stub!(:touch)
$stdin.stub!(:gets).and_return("Y")
View
2 spec/shell/basic_spec.rb
@@ -121,7 +121,7 @@ def shell
end
describe "#print_table" do
- before(:each) do
+ before do
@table = []
@table << ["abc", "#123", "first three"]
@table << ["", "#0", "empty"]
View
2 spec/spec_helper.rb
@@ -29,7 +29,7 @@
load File.join(File.dirname(__FILE__), "fixtures", "invoke.thor")
RSpec.configure do |config|
- config.before :each do
+ config.before do
ARGV.replace []
end
View
2 spec/thor_spec.rb
@@ -247,7 +247,7 @@ def shell
end
describe "on general" do
- before(:each) do
+ before do
@content = capture(:stdout){ MyScript.help(shell) }
end
View
2 spec/util_spec.rb
@@ -119,7 +119,7 @@ def self.clear_user_home!
end
describe "#user_home" do
- before(:each) do
+ before do
ENV.stub!(:[])
Thor::Util.clear_user_home!
end

0 comments on commit 509b87b

Please sign in to comment.