1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00

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,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