active_cucumber 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +28 -0
  3. data/.rubocop.yml +12 -24
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +73 -0
  6. data/DEVELOPMENT.md +14 -0
  7. data/Gemfile +17 -2
  8. data/Gemfile.lock +132 -110
  9. data/LICENSE.txt +1 -1
  10. data/README.md +63 -76
  11. data/Rakefile +15 -18
  12. data/active_cucumber.gemspec +22 -27
  13. data/cucumber.yml +1 -0
  14. data/documentation/horizontal_diff.png +0 -0
  15. data/documentation/vertical_diff.png +0 -0
  16. data/dprint.json +11 -0
  17. data/features/active_cucumber/attributes_for.feature +2 -12
  18. data/features/active_cucumber/create_many.feature +7 -13
  19. data/features/active_cucumber/create_one.feature +5 -9
  20. data/features/active_cucumber/diff_all/arrays_of_objects.feature +2 -11
  21. data/features/active_cucumber/diff_all/context_values.feature +1 -10
  22. data/features/active_cucumber/diff_all/converting_data.feature +4 -13
  23. data/features/active_cucumber/diff_all/filtering_columns.feature +2 -11
  24. data/features/active_cucumber/diff_all/filtering_rows.feature +2 -13
  25. data/features/active_cucumber/diff_all/mismatching_data.feature +4 -14
  26. data/features/active_cucumber/diff_one.feature +8 -13
  27. data/features/step_definitions/steps.rb +16 -15
  28. data/features/support/director.rb +2 -0
  29. data/features/support/env.rb +23 -25
  30. data/features/support/episode.rb +2 -0
  31. data/features/support/episode_creator.rb +6 -6
  32. data/features/support/episode_cucumberator.rb +2 -2
  33. data/features/support/genre.rb +2 -0
  34. data/features/support/show.rb +2 -0
  35. data/features/support/show_creator.rb +5 -4
  36. data/features/support/show_cucumberator.rb +3 -3
  37. data/features/support/subscription.rb +2 -0
  38. data/features/support/subscription_creator.rb +6 -6
  39. data/features/support/subscription_cucumberator.rb +4 -4
  40. data/lib/active_cucumber/active_record_builder.rb +26 -18
  41. data/lib/active_cucumber/creator.rb +44 -25
  42. data/lib/active_cucumber/cucumberator.rb +17 -15
  43. data/lib/active_cucumber/cucumparer.rb +13 -12
  44. data/lib/active_cucumber.rb +97 -25
  45. metadata +26 -166
  46. data/.coveralls.yml +0 -1
  47. data/circle.yml +0 -16
  48. data/cucumber_lint.yml +0 -13
@@ -1,14 +1,5 @@
1
1
  Feature: Verifying only certain columns
2
2
 
3
- As a developer working only on a subset of database columns
4
- I want to specify only those columns in my tests
5
- So that my specs are concise, noise free, and to the point.
6
-
7
- Rules:
8
- - tables given to `diff_all!` can contain only a subset of the existing columns
9
- - only the given columns are verified against the database content
10
-
11
-
12
3
  Background:
13
4
  Given the episodes:
14
5
  | SHOW | NAME | YEAR |
@@ -17,7 +8,7 @@ Feature: Verifying only certain columns
17
8
 
18
9
 
19
10
  Scenario: verifying all columns
20
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
11
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
21
12
  | SHOW | NAME | YEAR |
22
13
  | Star Trek TNG | Encounter at Farpoint | 1987 |
23
14
  | Star Trek TNG | All Good Things | 1994 |
@@ -25,7 +16,7 @@ Feature: Verifying only certain columns
25
16
 
26
17
 
27
18
  Scenario: verifying a subset of columns
28
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
19
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
29
20
  | YEAR |
30
21
  | 1987 |
31
22
  | 1994 |
@@ -1,16 +1,5 @@
1
1
  Feature: Verifying only certain database rows
2
2
 
3
- As a developer specifying the result of database operations
4
- I want to have the choice to verify either the full database content or only a part of it
5
- So that my specs aren't polluted by independent side effects and remain focussed on the functionality described.
6
-
7
- Rules:
8
- - when providing an ActiveRecord class to `ActiveCucumber.diff_all!`
9
- it verifies the whole database table
10
- - when providing an AREL query to `ActiveCucumber.diff_all!`
11
- it verifies only the specified records in the respective table
12
-
13
-
14
3
  Background:
15
4
  Given the episodes:
16
5
  | SHOW | NAME | YEAR |
@@ -20,7 +9,7 @@ Feature: Verifying only certain database rows
20
9
 
21
10
 
22
11
  Scenario: comparing against the whole table by providing an ActiveRecord class
23
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
12
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
24
13
  | SHOW | NAME | YEAR |
25
14
  | Star Trek TOS | The Paradise Syndrome | 1968 |
26
15
  | Star Trek TNG | Encounter at Farpoint | 1987 |
@@ -29,7 +18,7 @@ Feature: Verifying only certain database rows
29
18
 
30
19
 
31
20
  Scenario: comparing against a subset of a table by providing an AREL query
32
- When running "ActiveCucumber.diff_all! Show.first.episodes, table" with this table:
21
+ When running "ActiveCucumber.diff_all!(Show.first.episodes, table)" with this table:
33
22
  | SHOW | NAME | YEAR |
34
23
  | Star Trek TOS | The Paradise Syndrome | 1968 |
35
24
  Then the test passes
@@ -1,15 +1,5 @@
1
1
  Feature: comparing against all existing records
2
2
 
3
- As a developer verifying my database content
4
- I want that my specs verify the exact database content
5
- So that I can be sure that my application behaves exactly as I think it does.
6
-
7
- Rules:
8
- - missing rows cause test failure
9
- - extra rows cause test failure
10
- - mismatching fields cause test failure
11
-
12
-
13
3
  Background:
14
4
  Given the episodes:
15
5
  | SHOW | NAME | YEAR |
@@ -18,7 +8,7 @@ Feature: comparing against all existing records
18
8
 
19
9
 
20
10
  Scenario: complete table match
21
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
11
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
22
12
  | SHOW | NAME | YEAR |
23
13
  | Star Trek TNG | Encounter at Farpoint | 1987 |
24
14
  | Star Trek TNG | All Good Things | 1994 |
@@ -26,7 +16,7 @@ Feature: comparing against all existing records
26
16
 
27
17
 
28
18
  Scenario: missing a record
29
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
19
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
30
20
  | SHOW | NAME |
31
21
  | Star Trek TNG | Encounter at Farpoint |
32
22
  Then the test fails
@@ -34,7 +24,7 @@ Feature: comparing against all existing records
34
24
 
35
25
 
36
26
  Scenario: an extra record
37
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
27
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
38
28
  | SHOW | NAME |
39
29
  | Star Trek TNG | Encounter at Farpoint |
40
30
  | Star Trek TNG | All Good Things |
@@ -44,7 +34,7 @@ Feature: comparing against all existing records
44
34
 
45
35
 
46
36
  Scenario: mismatching data in a table cell
47
- When running "ActiveCucumber.diff_all! Episode, table" with this table:
37
+ When running "ActiveCucumber.diff_all!(Episode, table)" with this table:
48
38
  | SHOW | NAME |
49
39
  | Star Trek TOS | Encounter at Farpoint |
50
40
  | Star Trek TNG | All Good Things |
@@ -1,10 +1,5 @@
1
1
  Feature: ActiveCucumber.diff_one!
2
2
 
3
- As a Cucumber user
4
- I want to verify a single record using a detailed Cucumber table
5
- So that I can easily and intuitively check individual database entries.
6
-
7
-
8
3
  Background:
9
4
  Given the episode:
10
5
  | SHOW | Star Trek TNG |
@@ -13,26 +8,26 @@ Feature: ActiveCucumber.diff_one!
13
8
 
14
9
 
15
10
  Scenario: verifying string fields
16
- When running "ActiveCucumber.diff_one! @created_episode, table" with this table:
11
+ When running "ActiveCucumber.diff_one!(@created_episode, table)" with this table:
17
12
  | NAME | All Good Things |
18
13
  Then the test passes
19
14
 
20
15
 
21
16
  Scenario: verifying non-string fields
22
- When running "ActiveCucumber.diff_one! @created_episode, table" with this table:
23
- | YEAR | 1994 |
17
+ When running "ActiveCucumber.diff_one!(@created_episode, table)" with this table:
18
+ | YEAR | 1994 |
24
19
  Then the test passes
25
20
 
26
21
 
27
22
  Scenario: verifying associated fields
28
- When running "ActiveCucumber.diff_one! @created_episode, table" with this table:
23
+ When running "ActiveCucumber.diff_one!(@created_episode, table)" with this table:
29
24
  | SHOW | Star Trek TNG |
30
25
  | NAME | All Good Things |
31
26
  Then the test passes
32
27
 
33
28
 
34
29
  Scenario: complete table match
35
- When running "ActiveCucumber.diff_one! @created_episode, table" with this table:
30
+ When running "ActiveCucumber.diff_one!(@created_episode, table)" with this table:
36
31
  | SHOW | Star Trek TNG |
37
32
  | NAME | All Good Things |
38
33
  | YEAR | 1994 |
@@ -40,7 +35,7 @@ Feature: ActiveCucumber.diff_one!
40
35
 
41
36
 
42
37
  Scenario: providing a non-existing field
43
- When running "ActiveCucumber.diff_one! @created_episode, table" with this table:
38
+ When running "ActiveCucumber.diff_one!(@created_episode, table)" with this table:
44
39
  | NAME | All Good Things |
45
40
  | FOOBAR | 1994 |
46
41
  Then the test fails
@@ -48,7 +43,7 @@ Feature: ActiveCucumber.diff_one!
48
43
 
49
44
 
50
45
  Scenario: mismatching data in a table cell
51
- When running "ActiveCucumber.diff_one! @created_episode, table" with this table:
46
+ When running "ActiveCucumber.diff_one!(@created_episode, table)" with this table:
52
47
  | SHOW | Star Trek TOS |
53
48
  | NAME | All Good Things |
54
49
  Then the test fails
@@ -59,7 +54,7 @@ Feature: ActiveCucumber.diff_one!
59
54
  Given the subscription:
60
55
  | SUBSCRIBER | Q |
61
56
  | SHOW | Star Trek TNG |
62
- When running "ActiveCucumber.diff_one! @created_subscription, table, context: { current_user: 'Q' }" with this table:
57
+ When running "ActiveCucumber.diff_one!(@created_subscription, table, context: { current_user: 'Q' })" with this table:
63
58
  | SUBSCRIBER | me |
64
59
  | SHOW | Star Trek TNG |
65
60
  Then the test passes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Given(/^the (\w+):$/) do |class_name, table|
2
4
  singular = class_name.singularize
3
5
  clazz = singular.humanize.constantize
@@ -9,13 +11,15 @@ Given(/^the (\w+):$/) do |class_name, table|
9
11
  instance_variable_set "@created_#{class_name}", created_data
10
12
  end
11
13
 
12
-
13
-
14
14
  When(/^running "([^"]+)" with this table:$/) do |code, table|
15
15
  @previous_table = table
16
16
  begin
17
17
  @error_happened = false
18
- @result = eval code
18
+ # rubocop:disable Security/Eval
19
+ # Eval is used here to test the ActiveCucumber framework itself.
20
+ # The code strings are hardcoded in feature files under developer control.
21
+ @result = eval(code, binding, __FILE__, __LINE__)
22
+ # rubocop:enable Security/Eval
19
23
  rescue StandardError => e
20
24
  @error_happened = true
21
25
  @error_message = e.message
@@ -27,23 +31,23 @@ Then(/^"(.*?)" does not have a director$/) do |show_name|
27
31
  expect(Show.find_by(name: show_name).director).to be nil
28
32
  end
29
33
 
30
-
31
34
  Then(/^it returns the hash$/) do |hash_string|
32
- expect(@result).to match eval hash_string
35
+ # rubocop:disable Security/Eval
36
+ # Eval is necessary to evaluate Ruby hash literals containing database lookups.
37
+ # Hash strings are hardcoded in feature files under developer control.
38
+ expect(@result).to match eval(hash_string, binding, __FILE__, __LINE__)
39
+ # rubocop:enable Security/Eval
33
40
  end
34
41
 
35
-
36
42
  Then(/^the database contains no (episodes|shows)$/) do |class_name|
37
43
  expect(class_name.classify.constantize).to have(0).records
38
44
  end
39
45
 
40
-
41
46
  Then(/^the database contains the given episode$/) do
42
47
  expect(Episode).to have(1).instance
43
48
  ActiveCucumber.diff_one! Episode.first, @previous_table
44
49
  end
45
50
 
46
-
47
51
  Then(/^the database contains the given episodes$/) do
48
52
  ActiveCucumber.diff_all! Episode, @previous_table
49
53
  end
@@ -56,23 +60,20 @@ Then(/^the database contains the (\w+):$/) do |class_name, table|
56
60
  ActiveCucumber.diff_all! class_name.humanize.singularize.constantize, table
57
61
  end
58
62
 
59
-
60
63
  Then(/^the database contains the shows? (.+)$/) do |show_names|
61
- expect(Show.all.map(&:name)).to match Kappamaki.from_sentence show_names
64
+ expect(Show.all.map(&:name)).to match Kappamaki.from_sentence(show_names)
62
65
  end
63
66
 
64
-
65
67
  Then(/^the test (passes|fails)$/) do |expected_result|
66
68
  @error_checked = true
67
- if expected_result == 'passes' && @error_happened
69
+ if expected_result == "passes" && @error_happened
68
70
  puts "\n#{@error_message}"
69
- puts ''
71
+ puts ""
70
72
  @exception.backtrace.take(5).each { |trace| puts "in #{trace}" }
71
73
  end
72
- expect(@error_happened).to be expected_result != 'passes'
74
+ expect(@error_happened).to be expected_result != "passes"
73
75
  end
74
76
 
75
-
76
77
  Then(/^Cucumparer prints the error message "([^"]*)"$/) do |expected_error|
77
78
  expect(@error_message).to match expected_error
78
79
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Director < ActiveRecord::Base
2
4
  has_many :shows
3
5
  end
@@ -1,58 +1,57 @@
1
- if ENV['CI']
2
- require 'coveralls'
3
- Coveralls.wear!
4
- end
1
+ # frozen_string_literal: true
5
2
 
6
- require 'active_record'
7
- require 'sqlite3'
8
- require 'mortadella'
9
- require 'active_cucumber'
10
- require 'factory_girl'
11
- require 'faker'
12
- require 'kappamaki'
13
- require 'rspec/collection_matchers'
3
+ if ENV["CI"]
4
+ require "simplecov"
5
+ SimpleCov.start
6
+ end
14
7
 
8
+ require "active_record"
9
+ require "sqlite3"
10
+ require "mortadella"
11
+ require "active_cucumber"
12
+ require "factory_bot"
13
+ require "faker"
14
+ require "kappamaki"
15
+ require "rspec/collection_matchers"
15
16
 
16
17
  ActiveRecord::Base.establish_connection(
17
- adapter: 'sqlite3',
18
- database: ':memory:'
18
+ adapter: "sqlite3",
19
+ database: ":memory:"
19
20
  )
20
21
 
21
-
22
22
  ActiveRecord::Schema.define do
23
23
  create_table :genres, force: true do |t|
24
24
  t.string :name
25
- t.datetime 'created_at'
25
+ t.datetime "created_at"
26
26
  end
27
27
 
28
28
  create_table :shows, force: true do |t|
29
29
  t.belongs_to :genre
30
30
  t.belongs_to :director
31
31
  t.string :name
32
- t.datetime 'created_at'
32
+ t.datetime "created_at"
33
33
  end
34
34
 
35
35
  create_table :episodes, force: true do |t|
36
36
  t.belongs_to :show
37
37
  t.string :name
38
38
  t.integer :year
39
- t.datetime 'created_at'
39
+ t.datetime "created_at"
40
40
  end
41
41
 
42
42
  create_table :subscriptions, force: true do |t|
43
43
  t.string :subscriber
44
44
  t.belongs_to :show
45
- t.datetime 'created_at'
45
+ t.datetime "created_at"
46
46
  end
47
47
 
48
48
  create_table :directors, force: true do |t|
49
49
  t.string :name
50
- t.datetime 'created_at'
50
+ t.datetime "created_at"
51
51
  end
52
52
  end
53
53
 
54
-
55
- FactoryGirl.define do
54
+ FactoryBot.define do
56
55
  factory :genre do
57
56
  name { Faker::Book.title }
58
57
  end
@@ -64,7 +63,7 @@ FactoryGirl.define do
64
63
 
65
64
  factory :episode do
66
65
  name { Faker::Book.title }
67
- year { 1960 + rand(40) }
66
+ year { rand(1960..1999) }
68
67
  show
69
68
  end
70
69
 
@@ -78,7 +77,6 @@ FactoryGirl.define do
78
77
  end
79
78
  end
80
79
 
81
-
82
80
  Before do
83
81
  Show.delete_all
84
82
  Episode.delete_all
@@ -91,7 +89,7 @@ end
91
89
  After do
92
90
  if @error_happened && !@error_checked
93
91
  puts "\n#{@error_message}"
94
- puts ''
92
+ puts ""
95
93
  @exception.backtrace.take(5).each { |trace| puts "in #{trace}" }
96
94
  expect(@error_happened).to be false
97
95
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Episode < ActiveRecord::Base
2
4
  belongs_to :show, required: true
3
5
  end
@@ -1,12 +1,12 @@
1
- class EpisodeCreator < ActiveCucumber::Creator
1
+ # frozen_string_literal: true
2
2
 
3
- def value_for_show show_name
4
- Show.find_by(name: show_name) || FactoryGirl.create(:show, name: show_name, genre: @genre)
3
+ class EpisodeCreator < ActiveCucumber::Creator
4
+ def value_for_show(show_name)
5
+ Show.find_by(name: show_name) || FactoryBot.create(:show, name: show_name, genre: @genre)
5
6
  end
6
7
 
7
- def value_for_genre genre_name
8
- @genre = Genre.find_by(name: genre_name) || FactoryGirl.create(:genre, name: genre_name)
8
+ def value_for_genre(genre_name)
9
+ @genre = Genre.find_by(name: genre_name) || FactoryBot.create(:genre, name: genre_name)
9
10
  delete :genre
10
11
  end
11
-
12
12
  end
@@ -1,7 +1,7 @@
1
- class EpisodeCucumberator < ActiveCucumber::Cucumberator
1
+ # frozen_string_literal: true
2
2
 
3
+ class EpisodeCucumberator < ActiveCucumber::Cucumberator
3
4
  def value_for_show
4
5
  show.name
5
6
  end
6
-
7
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Genre < ActiveRecord::Base
2
4
  has_many :shows
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Show < ActiveRecord::Base
2
4
  belongs_to :genre
3
5
  belongs_to :director
@@ -1,8 +1,9 @@
1
- class ShowCreator < ActiveCucumber::Creator
1
+ # frozen_string_literal: true
2
2
 
3
- def value_for_director director_name
3
+ class ShowCreator < ActiveCucumber::Creator
4
+ def value_for_director(director_name)
4
5
  return nil if director_name.blank?
5
- Director.find_by(name: director_name) || FactoryGirl.create(:director, name: director_name)
6
- end
7
6
 
7
+ Director.find_by(name: director_name) || FactoryBot.create(:director, name: director_name)
8
+ end
8
9
  end
@@ -1,11 +1,11 @@
1
- class ShowCucumberator < ActiveCucumber::Cucumberator
1
+ # frozen_string_literal: true
2
2
 
3
+ class ShowCucumberator < ActiveCucumber::Cucumberator
3
4
  def value_for_director
4
- director.try :name
5
+ director&.name
5
6
  end
6
7
 
7
8
  def value_for_genre
8
9
  genre.name
9
10
  end
10
-
11
11
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Subscription < ActiveRecord::Base
2
4
  belongs_to :show
3
5
  end
@@ -1,11 +1,11 @@
1
- class SubscriptionCreator < ActiveCucumber::Creator
1
+ # frozen_string_literal: true
2
2
 
3
- def value_for_show show_name
4
- Show.find_by(name: show_name) || FactoryGirl.create(:show, name: show_name)
3
+ class SubscriptionCreator < ActiveCucumber::Creator
4
+ def value_for_show(show_name)
5
+ Show.find_by(name: show_name) || FactoryBot.create(:show, name: show_name)
5
6
  end
6
7
 
7
- def value_for_subscriber subscriber_name
8
- subscriber_name == 'me' ? @current_user : subscriber_name
8
+ def value_for_subscriber(subscriber_name)
9
+ subscriber_name == "me" ? @current_user : subscriber_name
9
10
  end
10
-
11
11
  end
@@ -1,11 +1,11 @@
1
- class SubscriptionCucumberator < ActiveCucumber::Cucumberator
1
+ # frozen_string_literal: true
2
2
 
3
+ class SubscriptionCucumberator < ActiveCucumber::Cucumberator
3
4
  def value_for_show
4
- show.try :name
5
+ show&.name
5
6
  end
6
7
 
7
8
  def value_for_subscriber
8
- subscriber == @current_user ? 'me' : subscriber
9
+ subscriber == @current_user ? "me" : subscriber
9
10
  end
10
-
11
11
  end
@@ -1,50 +1,58 @@
1
- module ActiveCucumber
1
+ # frozen_string_literal: true
2
2
 
3
+ module ActiveCucumber
3
4
  # Creates ActiveRecord entries with data from given Cucumber tables.
4
5
  class ActiveRecordBuilder
5
-
6
- def initialize activerecord_class, context
6
+ def initialize(activerecord_class, context)
7
7
  @clazz = activerecord_class
8
8
  @creator_class = creator_class
9
9
  @context = context
10
10
  end
11
11
 
12
-
13
- def attributes_for attributes
14
- @creator_class.new(attributes, @context).factorygirl_attributes
12
+ def attributes_for(attributes)
13
+ @creator_class.new(attributes, @context).factorybot_attributes
15
14
  end
16
15
 
17
-
18
16
  # Creates all entries in the given horizontal table hash
19
- def create_many table
17
+ def create_many(table)
20
18
  table.map do |row|
21
19
  create_record row
22
20
  end
23
21
  end
24
22
 
25
-
26
23
  # Creates a new record with the given attributes in the database
27
- def create_record attributes
24
+ def create_record(attributes)
28
25
  creator = @creator_class.new attributes, @context
29
- FactoryGirl.create @clazz.name.underscore.to_sym, creator.factorygirl_attributes
26
+ factorybot_attributes = creator.factorybot_attributes
27
+ factory_name = @clazz.name.underscore.to_sym
28
+ create_with_factory(factory_name, factorybot_attributes, attributes)
30
29
  end
31
30
 
31
+ private
32
+
33
+ # Creates a record using FactoryBot with error handling
34
+ def create_with_factory(factory_name, factorybot_attributes, attributes)
35
+ FactoryBot.create factory_name, factorybot_attributes
36
+ rescue ActiveRecord::RecordInvalid => e
37
+ record = e.record || @clazz.new
38
+ raise ActiveRecord::RecordInvalid.new(record,
39
+ "Failed to create #{@clazz.name} with attributes " \
40
+ "#{attributes.inspect}: #{e.message}")
41
+ rescue ArgumentError => e
42
+ raise ArgumentError, "Failed to create #{@clazz.name}: #{e.message}. " \
43
+ "Make sure a FactoryBot factory is defined for :#{factory_name}"
44
+ end
32
45
 
33
- private
34
-
35
- # Returns the Cucumberator subclass to be used by this Cucumparer instance
46
+ # Returns the Creator subclass to be used by this ActiveRecordBuilder instance.
36
47
  def creator_class
37
48
  creator_class_name.constantize
38
49
  rescue NameError
39
50
  Creator
40
51
  end
41
52
 
42
-
43
- # Returns the name of the Cucumberator subclass to be used by this Cucumparer instance.
53
+ # Returns the name of the Creator subclass to be used by this ActiveRecordBuilder instance.
44
54
  def creator_class_name
45
55
  "#{@clazz.name}Creator"
46
56
  end
47
-
48
57
  end
49
-
50
58
  end