Run standardrb

This commit applies the changes from running `standardrb --fix`
This commit is contained in:
Daniel Colson 2020-06-05 15:40:36 -04:00
parent aad77ceeb6
commit ce8bfb409b
11 changed files with 35 additions and 35 deletions

View File

@ -12,4 +12,4 @@ end
RSpec::Core::RakeTask.new(:spec)
desc "Run the test suite"
task default: %w(spec cucumber)
task default: %w[spec cucumber]

View File

@ -1,18 +1,18 @@
Gem::Specification.new do |s|
s.name = "factory_bot_rails"
s.version = "5.1.1"
s.authors = ["Joe Ferris"]
s.email = "jferris@thoughtbot.com"
s.homepage = "https://github.com/thoughtbot/factory_bot_rails"
s.summary = "factory_bot_rails provides integration between "\
s.name = "factory_bot_rails"
s.version = "5.1.1"
s.authors = ["Joe Ferris"]
s.email = "jferris@thoughtbot.com"
s.homepage = "https://github.com/thoughtbot/factory_bot_rails"
s.summary = "factory_bot_rails provides integration between "\
"factory_bot and rails 5.0 or newer"
s.description = "factory_bot_rails provides integration between "\
"factory_bot and rails 5.0 or newer"
s.files = Dir["lib/**/*"] + %w[CONTRIBUTING.md LICENSE NEWS.md README.md]
s.require_paths = ["lib"]
s.executables = []
s.license = "MIT"
s.executables = []
s.license = "MIT"
s.add_runtime_dependency("factory_bot", "~> 5.1.0")
s.add_runtime_dependency("railties", ">= 5.0.0")

View File

@ -1,10 +1,10 @@
When /^I run `([^"]+)` with a clean environment$/ do |command|
When(/^I run `([^"]+)` with a clean environment$/) do |command|
step <<~STEP
I successfully run `ruby -e 'system({"BUNDLE_GEMFILE" => nil, "DISABLE_SPRING" => "true"}, "#{command}")'`
STEP
end
When /^I run `([^"]+)` with Spring enabled$/ do |command|
When(/^I run `([^"]+)` with Spring enabled$/) do |command|
step <<~STEP
I successfully run `ruby -e 'system({"BUNDLE_GEMFILE" => nil}, "#{command}")'`
STEP

View File

@ -1,4 +1,4 @@
When /^I create a new rails application$/ do
When(/^I create a new rails application$/) do
options =
%w[
--api
@ -20,15 +20,15 @@ When /^I create a new rails application$/ do
cd("test_app")
end
When /^I add "([^"]+)" from this project as a dependency$/ do |gem_name|
append_to_file("Gemfile", %{gem "#{gem_name}", :path => "#{PROJECT_ROOT}"\n})
When(/^I add "([^"]+)" from this project as a dependency$/) do |gem_name|
append_to_file("Gemfile", %(gem "#{gem_name}", :path => "#{PROJECT_ROOT}"\n))
end
When /^I add "([^"]+)" as a dependency$/ do |gem_name|
append_to_file("Gemfile", %{gem "#{gem_name}"\n})
When(/^I add "([^"]+)" as a dependency$/) do |gem_name|
append_to_file("Gemfile", %(gem "#{gem_name}"\n))
end
When /^I print out "([^"]*)"$/ do |path|
When(/^I print out "([^"]*)"$/) do |path|
in_current_dir do
File.open(path, "r") do |f|
puts f.inspect
@ -36,7 +36,7 @@ When /^I print out "([^"]*)"$/ do |path|
end
end
When /^I configure the factories as:$/ do |string|
When(/^I configure the factories as:$/) do |string|
append_to_file File.join("config", "application.rb"), <<~RUBY
class TestApp::Application
#{string}
@ -44,7 +44,7 @@ When /^I configure the factories as:$/ do |string|
RUBY
end
When /^I configure the factories directory as "([^"]+)"$/ do |factory_dir|
When(/^I configure the factories directory as "([^"]+)"$/) do |factory_dir|
append_to_file File.join("config", "application.rb"), <<~RUBY
class TestApp::Application
config.generators do |g|
@ -54,7 +54,7 @@ When /^I configure the factories directory as "([^"]+)"$/ do |factory_dir|
RUBY
end
When /^I comment out gem "([^"]*)" from my Gemfile$/ do |gem_name|
When(/^I comment out gem "([^"]*)" from my Gemfile$/) do |gem_name|
in_current_dir do
content = File.read("Gemfile")
File.open("Gemfile", "w") do |f|

View File

@ -11,7 +11,7 @@ if RUBY_PLATFORM == "java"
Aruba.configure do |config|
config.before_cmd do
# disable JIT since these processes are so short lived
set_env("JRUBY_OPTS", "-X-C #{ENV['JRUBY_OPTS']}")
set_env("JRUBY_OPTS", "-X-C #{ENV["JRUBY_OPTS"]}")
java_options = ENV["JAVA_OPTS"]
@ -20,7 +20,7 @@ if RUBY_PLATFORM == "java"
else
set_env(
"JAVA_OPTS",
"-XX:+TieredCompilation -XX:TieredStopAtLevel=1 #{java_options}",
"-XX:+TieredCompilation -XX:TieredStopAtLevel=1 #{java_options}"
)
end
end

View File

@ -9,7 +9,7 @@ module FactoryBotRails
@generators.test_framework(
test_framework,
fixture: false,
fixture_replacement: :factory_bot,
fixture_replacement: :factory_bot
)
end

View File

@ -8,7 +8,7 @@ module FactoryBotRails
def run
@generators.fixture_replacement(
fixture_replacement_setting,
dir: factory_bot_directory,
dir: factory_bot_directory
)
end

View File

@ -8,7 +8,7 @@ module FactoryBot
File.dirname(__FILE__),
"factory_bot",
generator_name,
"templates",
"templates"
)
File.expand_path(path)

View File

@ -8,21 +8,21 @@ module FactoryBot
:attributes,
type: :array,
default: [],
banner: "field:type field:type",
banner: "field:type field:type"
)
class_option(
:dir,
type: :string,
default: "test/factories",
desc: "The directory or file root where factories belong",
desc: "The directory or file root where factories belong"
)
class_option(
:suffix,
type: :string,
default: nil,
desc: "Suffix to add factory file",
desc: "Suffix to add factory file"
)
def create_fixture_file
@ -43,7 +43,7 @@ module FactoryBot
insert_into_file(
factories_file,
factory_definition,
after: "FactoryBot.define do\n",
after: "FactoryBot.define do\n"
)
end
@ -55,16 +55,16 @@ module FactoryBot
def factory_definition
<<~RUBY
factory :#{factory_name}#{explicit_class_option} do
#{factory_attributes.gsub(/^/, ' ')}
#{factory_attributes.gsub(/^/, " ")}
end
RUBY
end
def factory_attributes
attributes.map do |attribute|
attributes.map { |attribute|
"#{attribute.name} { #{attribute.default.inspect} }"
end.join("\n")
}.join("\n")
end
def filename

View File

@ -18,7 +18,7 @@ describe FactoryBotRails::DefinitionFilePaths do
directories = described_class.new(definition_file_paths).directories
expect(directories).to eq(
"spec/fixtures/factories" => [:rb],
"spec/fixtures/factories" => [:rb]
)
end

View File

@ -42,8 +42,8 @@ describe FactoryBotRails::Reloader do
def run_reloader(definition_file_paths)
FactoryBot.definition_file_paths = definition_file_paths
FactoryBotRails::Reloader.
new(Rails.application, Rails.application.config).run
FactoryBotRails::Reloader
.new(Rails.application, Rails.application.config).run
end
def reloader_class