Browse files

Replace double with single quotes

  • Loading branch information...
1 parent bff19ce commit 47012dfc63c61224b34ffffe0887318037da4e61 @stevehodgkiss committed Jan 28, 2012
View
6 lib/generator_spec/test_case.rb
@@ -1,6 +1,6 @@
-require "rspec/rails"
-require "rails/generators/test_case"
-require "generator_spec/matcher"
+require 'rspec/rails'
+require 'rails/generators/test_case'
+require 'generator_spec/matcher'
module GeneratorSpec
module TestCase
View
2 lib/generator_spec/version.rb
@@ -1,3 +1,3 @@
module GeneratorSpec
- VERSION = "0.8.4"
+ VERSION = '0.8.4'
end
View
198 spec/generator_spec/matcher_spec.rb
@@ -1,8 +1,8 @@
-require "spec_helper"
+require 'spec_helper'
-describe TestGenerator, "using custom matcher" do
+describe TestGenerator, 'using custom matcher' do
include GeneratorSpec::TestCase
- destination File.expand_path("../../tmp", __FILE__)
+ destination File.expand_path('../../tmp', __FILE__)
arguments %w(test --test)
before do
@@ -12,79 +12,79 @@
specify do
destination_root.should have_structure {
- no_file "test.rb"
- directory "config" do
- directory "initializers" do
- file "test.rb" do
- contains "# Initializer"
+ no_file 'test.rb'
+ directory 'config' do
+ directory 'initializers' do
+ file 'test.rb' do
+ contains '# Initializer'
end
end
end
- directory "db" do
- directory "migrate" do
- file "123_create_tests.rb"
- migration "create_tests" do
- contains "class TestMigration"
+ directory 'db' do
+ directory 'migrate' do
+ file '123_create_tests.rb'
+ migration 'create_tests' do
+ contains 'class TestMigration'
end
end
end
}
end
- it "fails when it doesnt match" do
+ it 'fails when it doesnt match' do
expect {
destination_root.should have_structure {
- directory "db" do
- directory "migrate" do
- no_file "123_create_tests.rb"
+ directory 'db' do
+ directory 'migrate' do
+ no_file '123_create_tests.rb'
end
end
}
}.to raise_error
end
end
-TMP_ROOT = Pathname.new(File.expand_path("../../tmp"))
+TMP_ROOT = Pathname.new(File.expand_path('../../tmp'))
module GeneratorSpec::Matcher
describe File do
- describe "#matches?" do
+ describe '#matches?' do
include FakeFS::SpecHelpers
before do
- @file = File.new("test_file")
- @location = TMP_ROOT.join("test_file")
+ @file = File.new('test_file')
+ @location = TMP_ROOT.join('test_file')
end
- context "with no contains" do
- it "doesn't throw if the file exists" do
- write_file(@location, "")
+ context 'with no contains' do
+ it 'doesnt throw if the file exists' do
+ write_file(@location, '')
expect {
@file.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws :failure if it doesn't exist" do
+ it 'throws :failure if it doesnt exist' do
expect {
@file.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
end
end
- context "with contains" do
+ context 'with contains' do
before do
- write_file(@location, "class CreatePosts")
+ write_file(@location, 'class CreatePosts')
end
- it "doesn't throw if the content includes the string" do
- @file.contains "CreatePosts"
+ it 'doesnt throw if the content includes the string' do
+ @file.contains 'CreatePosts'
expect {
@file.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws :failure if the contents don't include the string" do
- @file.contains "PostsMigration"
+ it 'throws :failure if the contents dont include the string' do
+ @file.contains 'PostsMigration'
expect {
@file.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
@@ -96,41 +96,41 @@ module GeneratorSpec::Matcher
describe Migration do
include FakeFS::SpecHelpers
- describe "#matches?" do
+ describe '#matches?' do
before do
- @migration = Migration.new("create_posts")
- @location = TMP_ROOT.join("123456_create_posts.rb")
+ @migration = Migration.new('create_posts')
+ @location = TMP_ROOT.join('123456_create_posts.rb')
end
- context "with no contains" do
- it "doesn't throw if the migration exists" do
- write_file(@location, "class CreatePosts")
+ context 'with no contains' do
+ it 'doesnt throw if the migration exists' do
+ write_file(@location, 'class CreatePosts')
expect {
@migration.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws :failure if it doesn't exist" do
+ it 'throws :failure if it doesnt exist' do
expect {
@migration.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
end
end
- context "with contains" do
+ context 'with contains' do
before do
- write_file(@location, "class CreatePosts")
+ write_file(@location, 'class CreatePosts')
end
- it "doesn't throw if the migration includes the given content" do
- @migration.contains("CreatePosts")
+ it 'doesnt throw if the migration includes the given content' do
+ @migration.contains('CreatePosts')
expect {
@migration.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws failure if the migration doesn't include the given content" do
- @migration.contains("CreateNotes")
+ it 'throws failure if the migration doesnt include the given content' do
+ @migration.contains('CreateNotes')
expect {
@migration.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
@@ -142,116 +142,116 @@ module GeneratorSpec::Matcher
describe Directory do
include FakeFS::SpecHelpers
- describe "#location" do
- it "equals the full path" do
- Directory.new("test").location("test_2").should eq("test/test_2")
+ describe '#location' do
+ it 'equals the full path' do
+ Directory.new('test').location('test_2').should eq('test/test_2')
end
end
- describe "#directory" do
- context "without a block" do
- it "adds a directory name to the tree" do
- dir = Directory.new "test" do
- directory "dir"
+ describe '#directory' do
+ context 'without a block' do
+ it 'adds a directory name to the tree' do
+ dir = Directory.new 'test' do
+ directory 'dir'
end
- dir.tree["dir"].should eq(false)
+ dir.tree['dir'].should eq(false)
end
end
- context "with a block" do
- it "add a directory object to the tree" do
- dir = Directory.new "test" do
- directory "dir" do
- directory "test_2"
+ context 'with a block' do
+ it 'add a directory object to the tree' do
+ dir = Directory.new 'test' do
+ directory 'dir' do
+ directory 'test_2'
end
end
- dir.tree["dir"].should be_an_instance_of(Directory)
- dir.tree["dir"].tree["test_2"].should eq(false)
+ dir.tree['dir'].should be_an_instance_of(Directory)
+ dir.tree['dir'].tree['test_2'].should eq(false)
end
end
end
- describe "#file" do
- it "adds it to the tree" do
- dir = Directory.new "test" do
- file "test_file"
+ describe '#file' do
+ it 'adds it to the tree' do
+ dir = Directory.new 'test' do
+ file 'test_file'
end
- dir.tree["test_file"].should be_an_instance_of(File)
+ dir.tree['test_file'].should be_an_instance_of(File)
end
end
- describe "#file" do
- it "adds it to the tree" do
- dir = Directory.new "test" do
- migration "test_file"
+ describe '#file' do
+ it 'adds it to the tree' do
+ dir = Directory.new 'test' do
+ migration 'test_file'
end
- dir.tree["test_file"].should be_an_instance_of(Migration)
- dir.tree["test_file"].instance_variable_get("@name").should eq("test/test_file")
+ dir.tree['test_file'].should be_an_instance_of(Migration)
+ dir.tree['test_file'].instance_variable_get('@name').should eq('test/test_file')
end
end
- describe "#matches?" do
- context "with a directory name" do
+ describe '#matches?' do
+ context 'with a directory name' do
before do
- @dir = Directory.new "test" do
- directory "test_2"
+ @dir = Directory.new 'test' do
+ directory 'test_2'
end
end
- it "doesn't throw if the directory exists" do
- write_directory(TMP_ROOT.join("test/test_2"))
+ it 'doesnt throw if the directory exists' do
+ write_directory(TMP_ROOT.join('test/test_2'))
expect {
@dir.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws :failure if it doesn't exist" do
+ it 'throws :failure if it doesnt exist' do
expect {
@dir.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
end
end
- context "with a directory object" do
+ context 'with a directory object' do
before do
- @dir = Directory.new "test" do
- directory "test_2" do
- file "test_file"
+ @dir = Directory.new 'test' do
+ directory 'test_2' do
+ file 'test_file'
end
end
- write_directory(TMP_ROOT.join("test/test_2"))
+ write_directory(TMP_ROOT.join('test/test_2'))
end
- it "doesn't throw if the file exists" do
- write_file(TMP_ROOT.join("test/test_2/test_file"), "")
+ it 'doesnt throw if the file exists' do
+ write_file(TMP_ROOT.join('test/test_2/test_file'), '')
expect {
@dir.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws :failure if it doesn't exist" do
+ it 'throws :failure if it doesnt exist' do
expect {
@dir.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
end
end
- context "#no_file" do
+ context '#no_file' do
before do
- @dir = Directory.new "test" do
- no_file "test_file"
+ @dir = Directory.new 'test' do
+ no_file 'test_file'
end
- write_directory(TMP_ROOT.join("test"))
+ write_directory(TMP_ROOT.join('test'))
end
- it "doesn't throw if the file exist" do
+ it 'doesnt throw if the file exist' do
expect {
@dir.matches?(TMP_ROOT)
}.to_not throw_symbol
end
- it "throws if the file exists" do
- write_file(TMP_ROOT.join("test/test_file"), "")
+ it 'throws if the file exists' do
+ write_file(TMP_ROOT.join('test/test_file'), '')
expect {
@dir.matches?(TMP_ROOT)
}.to throw_symbol(:failure)
@@ -264,19 +264,19 @@ module GeneratorSpec::Matcher
describe Root do
include FakeFS::SpecHelpers
- describe "#matches?" do
+ describe '#matches?' do
before do
- @root = Root.new "test" do
- directory "test_dir"
+ @root = Root.new 'test' do
+ directory 'test_dir'
end
end
- it "returns true on no failures" do
- write_directory(TMP_ROOT.join("test/test_dir"))
+ it 'returns true on no failures' do
+ write_directory(TMP_ROOT.join('test/test_dir'))
@root.matches?(TMP_ROOT).should be_true
end
- it "returns false on failures" do
+ it 'returns false on failures' do
@root.matches?(TMP_ROOT).should be_false
end
end
View
42 spec/generator_spec/test_case_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require 'spec_helper'
class TestClass
@@ -13,58 +13,58 @@ class TestClass
@klass.test_case_instance = mock
end
- it "passes unknown messages on to test_case_instance" do
- @klass.test_case_instance.should_receive(:assert_file).with("test")
- @klass.new.assert_file("test")
+ it 'passes unknown messages on to test_case_instance' do
+ @klass.test_case_instance.should_receive(:assert_file).with('test')
+ @klass.new.assert_file('test')
end
- it "handles respond_to accordingly" do
+ it 'handles respond_to accordingly' do
@klass.test_case_instance.should_receive(:respond_to?).with(:assert_no_file).and_return(true)
@klass.new.respond_to?(:assert_no_file).should be_true
end
end
-describe TestGenerator, "using normal assert methods" do
+describe TestGenerator, 'using normal assert methods' do
include GeneratorSpec::TestCase
- destination File.expand_path("../../tmp", __FILE__)
+ destination File.expand_path('../../tmp', __FILE__)
arguments %w(test --test)
before(:all) do
prepare_destination
run_generator
end
- it "creates a test initializer" do
- assert_file "config/initializers/test.rb", "# Initializer"
+ it 'creates a test initializer' do
+ assert_file 'config/initializers/test.rb', '# Initializer'
end
- it "creates a migration" do
- assert_migration "db/migrate/create_tests.rb"
+ it 'creates a migration' do
+ assert_migration 'db/migrate/create_tests.rb'
end
- it "removes files" do
- assert_no_file ".gitignore"
+ it 'removes files' do
+ assert_no_file '.gitignore'
end
end
-describe TestGenerator, "with contexts" do
+describe TestGenerator, 'with contexts' do
include GeneratorSpec::TestCase
- destination File.expand_path("../../tmp", __FILE__)
+ destination File.expand_path('../../tmp', __FILE__)
before { prepare_destination }
- context "with --test flag" do
+ context 'with --test flag' do
before { run_generator %w(test --test) }
- it "creates a test initializer" do
- assert_file "config/initializers/test.rb", "# Initializer"
+ it 'creates a test initializer' do
+ assert_file 'config/initializers/test.rb', '# Initializer'
end
end
- context "without any flags" do
+ context 'without any flags' do
before { run_generator %w(test) }
- it "doesn't create a test initializer" do
- assert_no_file "config/initializers/test.rb"
+ it 'doesn\'t create a test initializer' do
+ assert_no_file 'config/initializers/test.rb'
end
end
end
View
2 spec/spec_helper.rb
@@ -4,7 +4,7 @@
require 'generator_spec/test_case'
require 'fakefs/spec_helpers'
-Dir[Pathname.new(File.expand_path("../", __FILE__)).join("support/**/*.rb")].each {|f| require f}
+Dir[Pathname.new(File.expand_path('../', __FILE__)).join('support/**/*.rb')].each {|f| require f}
RSpec.configure do |config|
config.include Helpers::FileSystem

0 comments on commit 47012df

Please sign in to comment.