-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix test #151
Open
koheisg
wants to merge
2
commits into
rroblak:master
Choose a base branch
from
koheisg:fix-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix test #151
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ref: [Deprecating static attributes in factory_bot 4.11](https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11) ``` $ rspec ./spec/environment_spec.rb:22 # SeedDump.dump_using_environment APPEND should specify append as true if the APPEND env var is 'TRUE' An error occurred while loading ./spec/environment_spec.rb. Failure/Error: string 'string' NoMethodError: undefined method 'string' in 'another_sample' factory Did you mean? 'string { "string" }' Run options: include {:locations=>{"./spec/environment_spec.rb"=>[22]}} All examples were filtered out Finished in 0.00004 seconds (files took 1.18 seconds to load) 0 examples, 0 failures, 1 error occurred outside of examples ``` Fix by ``` $ rubocop -a --require rubocop-rspec --only FactoryBot/AttributeDefinedStatically ``` thank you
needs to `Multiple Databases with Active Record` before ``` $ rspec Randomized with seed 34569 .FFFFF..F.FF..FFF................. Failures: 1) SeedDump.dump_using_environment APPEND should specify append as false the first time if the APPEND env var is not 'true' (and true after that) Failure/Error: SeedDump.should_receive(:dump).with(anything, include(append: true)).ordered (SeedDump (class)).dump(anything, include {:append => true}) expected: 1 time with arguments: (anything, include {:append => true}) received: 2 times with arguments: (anything, include {:append => true}) # ./spec/environment_spec.rb:32:in `block (4 levels) in <top (required)>' 2) SeedDump.dump_using_environment APPEND should specify append as true if the APPEND env var is 'true' Failure/Error: SeedDump.should_receive(:dump).with(anything, include(append: true)) (SeedDump (class)).dump(anything, include {:append => true}) expected: 1 time with arguments: (anything, include {:append => true}) received: 2 times with arguments: (anything, include {:append => true}) # ./spec/environment_spec.rb:17:in `block (4 levels) in <top (required)>' 3) SeedDump.dump_using_environment APPEND should specify append as true if the APPEND env var is 'TRUE' Failure/Error: SeedDump.should_receive(:dump).with(anything, include(append: true)) (SeedDump (class)).dump(anything, include {:append => true}) expected: 1 time with arguments: (anything, include {:append => true}) received: 2 times with arguments: (anything, include {:append => true}) # ./spec/environment_spec.rb:23:in `block (4 levels) in <top (required)>' 4) SeedDump.dump_using_environment BATCH_SIZE should pass along the specified batch size Failure/Error: SeedDump.should_receive(:dump).with(anything, include(batch_size: 17)) (SeedDump (class)).dump(anything, include {:batch_size => 17}) expected: 1 time with arguments: (anything, include {:batch_size => 17}) received: 2 times with arguments: (anything, include {:batch_size => 17}) # ./spec/environment_spec.rb:40:in `block (4 levels) in <top (required)>' 5) SeedDump.dump_using_environment BATCH_SIZE should pass along a nil batch size if BATCH_SIZE is not specified Failure/Error: SeedDump.should_receive(:dump).with(anything, include(batch_size: nil)) (SeedDump (class)).dump(anything, include {:batch_size => nil}) expected: 1 time with arguments: (anything, include {:batch_size => nil}) received: 2 times with arguments: (anything, include {:batch_size => nil}) # ./spec/environment_spec.rb:46:in `block (4 levels) in <top (required)>' 6) SeedDump.dump_using_environment MODEL if MODEL is not specified should dump all non-empty models Failure/Error: SeedDump.dump(model, append: append, batch_size: retrieve_batch_size_value(env), exclude: retrieve_exclude_value(env), file: retrieve_file_value(env), import: retrieve_import_value(env)) #<SeedDump (class)> received :dump with unexpected arguments expected: (Sample(id: integer, string: string, text: text, integer: integer, float: float, decimal: decimal, dat...ime: time, date: date, binary: binary, boolean: boolean, created_at: datetime, updated_at: datetime), anything) got: (#<Class:0x00007fd52f390240>(version: string), {:append=>false, :batch_size=>nil, :exclude=>nil, :file=>"db/seeds.rb", :import=>false}) Diff: @@ -1,3 +1,7 @@ -[Sample(id: integer, string: string, text: text, integer: integer, float: float, decimal: decimal, datetime: datetime, time: time, date: date, binary: binary, boolean: boolean, created_at: datetime, updated_at: datetime), - "anything"] +[#<Class:0x00007fd52f390240>(version: string), + {:append=>false, + :batch_size=>nil, + :exclude=>nil, + :file=>"db/seeds.rb", + :import=>false}] # ./lib/seed_dump/environment.rb:14:in `block in dump_using_environment' # ./lib/seed_dump/environment.rb:11:in `each' # ./lib/seed_dump/environment.rb:11:in `dump_using_environment' # ./spec/environment_spec.rb:98:in `block (6 levels) in <top (required)>' 7) SeedDump.dump_using_environment EXCLUDE should pass along any attributes to be excluded Failure/Error: SeedDump.should_receive(:dump).with(anything, include(exclude: [:baggins, :saggins])) (SeedDump (class)).dump(anything, include {:exclude => [:baggins, :saggins]}) expected: 1 time with arguments: (anything, include {:exclude => [:baggins, :saggins]}) received: 2 times with arguments: (anything, include {:exclude => [:baggins, :saggins]}) # ./spec/environment_spec.rb:54:in `block (4 levels) in <top (required)>' 8) SeedDump.dump_using_environment MODELS_EXCLUDE should dump all non-empty models except the specified models Failure/Error: SeedDump.dump(model, append: append, batch_size: retrieve_batch_size_value(env), exclude: retrieve_exclude_value(env), file: retrieve_file_value(env), import: retrieve_import_value(env)) #<SeedDump (class)> received :dump with unexpected arguments expected: (Sample(id: integer, string: string, text: text, integer: integer, float: float, decimal: decimal, dat...ime: time, date: date, binary: binary, boolean: boolean, created_at: datetime, updated_at: datetime), anything) got: (#<Class:0x00007fd52f390240>(version: string), {:append=>false, :batch_size=>nil, :exclude=>nil, :file=>"db/seeds.rb", :import=>false}) Diff: @@ -1,3 +1,7 @@ -[Sample(id: integer, string: string, text: text, integer: integer, float: float, decimal: decimal, datetime: datetime, time: time, date: date, binary: binary, boolean: boolean, created_at: datetime, updated_at: datetime), - "anything"] +[#<Class:0x00007fd52f390240>(version: string), + {:append=>false, + :batch_size=>nil, + :exclude=>nil, + :file=>"db/seeds.rb", + :import=>false}] # ./lib/seed_dump/environment.rb:14:in `block in dump_using_environment' # ./lib/seed_dump/environment.rb:11:in `each' # ./lib/seed_dump/environment.rb:11:in `dump_using_environment' # ./spec/environment_spec.rb:126:in `block (4 levels) in <top (required)>' 9) SeedDump.dump_using_environment MODELS if MODELS is not specified should dump all non-empty models Failure/Error: SeedDump.dump(model, append: append, batch_size: retrieve_batch_size_value(env), exclude: retrieve_exclude_value(env), file: retrieve_file_value(env), import: retrieve_import_value(env)) #<SeedDump (class)> received :dump with unexpected arguments expected: (Sample(id: integer, string: string, text: text, integer: integer, float: float, decimal: decimal, dat...ime: time, date: date, binary: binary, boolean: boolean, created_at: datetime, updated_at: datetime), anything) got: (#<Class:0x00007fd52f390240>(version: string), {:append=>false, :batch_size=>nil, :exclude=>nil, :file=>"db/seeds.rb", :import=>false}) Diff: @@ -1,3 +1,7 @@ -[Sample(id: integer, string: string, text: text, integer: integer, float: float, decimal: decimal, datetime: datetime, time: time, date: date, binary: binary, boolean: boolean, created_at: datetime, updated_at: datetime), - "anything"] +[#<Class:0x00007fd52f390240>(version: string), + {:append=>false, + :batch_size=>nil, + :exclude=>nil, + :file=>"db/seeds.rb", + :import=>false}] # ./lib/seed_dump/environment.rb:14:in `block in dump_using_environment' # ./lib/seed_dump/environment.rb:11:in `each' # ./lib/seed_dump/environment.rb:11:in `dump_using_environment' # ./spec/environment_spec.rb:98:in `block (6 levels) in <top (required)>' 10) SeedDump.dump_using_environment FILE should pass db/seeds.rb as the file parameter if no FILE is specified Failure/Error: SeedDump.should_receive(:dump).with(anything, include(file: 'db/seeds.rb')) (SeedDump (class)).dump(anything, include {:file => "db/seeds.rb"}) expected: 1 time with arguments: (anything, include {:file => "db/seeds.rb"}) received: 2 times with arguments: (anything, include {:file => "db/seeds.rb"}) # ./spec/environment_spec.rb:68:in `block (4 levels) in <top (required)>' 11) SeedDump.dump_using_environment FILE should pass the FILE parameter to the dump method correctly Failure/Error: SeedDump.should_receive(:dump).with(anything, include(file: 'blargle')) (SeedDump (class)).dump(anything, include {:file => "blargle"}) expected: 1 time with arguments: (anything, include {:file => "blargle"}) received: 2 times with arguments: (anything, include {:file => "blargle"}) # ./spec/environment_spec.rb:62:in `block (4 levels) in <top (required)>' Deprecation Warnings: Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/sugikouhei/.ghq/github.com/rroblak/seed_dump/spec/dump_methods_spec.rb:142:in `block (4 levels) in <top (required)>'. Using `stub` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead. Called from /Users/sugikouhei/.ghq/github.com/rroblak/seed_dump/spec/environment_spec.rb:135:in `block (3 levels) in <top (required)>'. If you need more of the backtrace for any of these deprecations to identify where to make the necessary changes, you can configure `config.raise_errors_for_deprecations!`, and it will turn the deprecation warnings into errors, giving you the full backtrace. 2 deprecation warnings total Finished in 0.57962 seconds (files took 1.2 seconds to load) 34 examples, 11 failures Failed examples: rspec ./spec/environment_spec.rb:28 # SeedDump.dump_using_environment APPEND should specify append as false the first time if the APPEND env var is not 'true' (and true after that) rspec ./spec/environment_spec.rb:16 # SeedDump.dump_using_environment APPEND should specify append as true if the APPEND env var is 'true' rspec ./spec/environment_spec.rb:22 # SeedDump.dump_using_environment APPEND should specify append as true if the APPEND env var is 'TRUE' rspec ./spec/environment_spec.rb:39 # SeedDump.dump_using_environment BATCH_SIZE should pass along the specified batch size rspec ./spec/environment_spec.rb:45 # SeedDump.dump_using_environment BATCH_SIZE should pass along a nil batch size if BATCH_SIZE is not specified rspec ./spec/environment_spec.rb[1:1:6:1:1] # SeedDump.dump_using_environment MODEL if MODEL is not specified should dump all non-empty models rspec ./spec/environment_spec.rb:53 # SeedDump.dump_using_environment EXCLUDE should pass along any attributes to be excluded rspec ./spec/environment_spec.rb:121 # SeedDump.dump_using_environment MODELS_EXCLUDE should dump all non-empty models except the specified models rspec ./spec/environment_spec.rb[1:1:7:1:1] # SeedDump.dump_using_environment MODELS if MODELS is not specified should dump all non-empty models rspec ./spec/environment_spec.rb:67 # SeedDump.dump_using_environment FILE should pass db/seeds.rb as the file parameter if no FILE is specified rspec ./spec/environment_spec.rb:61 # SeedDump.dump_using_environment FILE should pass the FILE parameter to the dump method correctly Randomized with seed 34569 ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix broken test on my environment.
Add ACTIVE_RECORD_INTERNAL_MODELS primary::SchemaMigration
Multiple Databases with Active Record
Fix Deprecating static attributes in factory_bot
$ rubocop -a --require rubocop-rspec --only FactoryBot/AttributeDefinedStatically
thank you!