Class: ConvenientService::RSpec::Helpers::Classes::StubEntry::Entities::StubbedFeature

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb

Instance Method Summary collapse

Constructor Details

#initialize(feature_class:, entry_name:) ⇒ void

Parameters:



23
24
25
26
27
# File 'lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb', line 23

def initialize(feature_class:, entry_name:)
  @feature_class = feature_class
  @entry_name = entry_name
  @arguments = nil
end

Instance Method Details

#==(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


77
78
79
80
81
82
83
84
85
86
# File 'lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb', line 77

def ==(other)
  return unless other.instance_of?(self.class)

  return false if feature_class != other.feature_class
  return false if entry_name != other.entry_name
  return false if arguments != other.arguments
  return false if value_spec != other.value_spec

  true
end

#to(value_spec) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Parameters:

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


63
64
65
66
67
68
69
70
71
# File 'lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb', line 63

def to(value_spec)
  @value_spec = value_spec

  feature_class.commit_config!(trigger: Constants::Triggers::STUB_ENTRY)

  Feature::Plugins::CanHaveStubbedEntries::Commands::SetFeatureStubbedEntry[feature: feature_class, entry: entry_name, arguments: arguments, value: value]

  self
end

#with_any_argumentsConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


44
45
46
47
48
# File 'lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb', line 44

def with_any_arguments(...)
  @arguments = nil

  self
end

#with_argumentsConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


32
33
34
35
36
# File 'lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb', line 32

def with_arguments(...)
  @arguments = Support::Arguments.new(...)

  self
end

#without_argumentsConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


53
54
55
56
57
# File 'lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb', line 53

def without_arguments
  @arguments = Support::Arguments.null_arguments

  self
end