Skip to content

Commit

Permalink
Run standardrb
Browse files Browse the repository at this point in the history
This commit applies the changes from running `standardrb --fix`
  • Loading branch information
composerinteralia committed Jun 10, 2020
1 parent aad77ce commit ce8bfb4
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
16 changes: 8 additions & 8 deletions factory_bot_rails.gemspec
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"
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 = "[email protected]"
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")
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/appraisal.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 9 additions & 9 deletions features/step_definitions/rails_steps.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
When /^I create a new rails application$/ do
When(/^I create a new rails application$/) do
options =
%w[
--api
Expand All @@ -20,31 +20,31 @@
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
end
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}
end
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|
Expand All @@ -54,7 +54,7 @@ class TestApp::Application
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|
Expand Down
4 changes: 2 additions & 2 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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"]

Expand All @@ -20,7 +20,7 @@
else
set_env(
"JAVA_OPTS",
"-XX:+TieredCompilation -XX:TieredStopAtLevel=1 #{java_options}",
"-XX:+TieredCompilation -XX:TieredStopAtLevel=1 #{java_options}"
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/factory_bot_rails/generators/non_rspec_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def run
@generators.test_framework(
test_framework,
fixture: false,
fixture_replacement: :factory_bot,
fixture_replacement: :factory_bot
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/factory_bot_rails/generators/rspec_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(generators)
def run
@generators.fixture_replacement(
fixture_replacement_setting,
dir: factory_bot_directory,
dir: factory_bot_directory
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/generators/factory_bot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.source_root
File.dirname(__FILE__),
"factory_bot",
generator_name,
"templates",
"templates"
)

File.expand_path(path)
Expand Down
14 changes: 7 additions & 7 deletions lib/generators/factory_bot/model/model_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ class ModelGenerator < Base
: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
Expand All @@ -43,7 +43,7 @@ def insert_factory_into_existing_file
insert_into_file(
factories_file,
factory_definition,
after: "FactoryBot.define do\n",
after: "FactoryBot.define do\n"
)
end

Expand All @@ -55,16 +55,16 @@ def create_factory_file
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
Expand Down
2 changes: 1 addition & 1 deletion spec/factory_bot_rails/definition_file_paths_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
directories = described_class.new(definition_file_paths).directories

expect(directories).to eq(
"spec/fixtures/factories" => [:rb],
"spec/fixtures/factories" => [:rb]
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/factory_bot_rails/reloader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

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
Expand Down

0 comments on commit ce8bfb4

Please sign in to comment.