Module: RSpecApi::DSL::Fixtures

Included in:
RSpecApi::DSL, Actions
Defined in:
lib/rspec-api/fixtures/empty.rb,
lib/rspec-api/fixtures/local.rb,
lib/rspec-api/fixtures/remote.rb

Overview

rename to Fixtures

Instance Method Summary collapse

Instance Method Details

#apply(method_name, options = {}) ⇒ Object



12
13
14
# File 'lib/rspec-api/fixtures/empty.rb', line 12

def apply(method_name, options = {})
  options[:to].merge(apply: method_name, value: -> { options[:to][:value].call.send method_name })
end

#create_fixtureObject



26
27
28
# File 'lib/rspec-api/fixtures/empty.rb', line 26

def create_fixture
  # To be overriden
end

#destroy_fixtureObject



30
31
32
# File 'lib/rspec-api/fixtures/empty.rb', line 30

def destroy_fixture
  # To be overriden
end

#existing(field) ⇒ Object



4
5
6
# File 'lib/rspec-api/fixtures/empty.rb', line 4

def existing(field)
  # To be overriden
end

#existing_value_for(field) ⇒ Object



41
42
43
# File 'lib/rspec-api/fixtures/local.rb', line 41

def existing_value_for(field)
  -> {@resource.to_s.classify.constantize.pluck(field).first}
end

#invalid(options = {}) ⇒ Object



21
22
23
24
# File 'lib/rspec-api/fixtures/empty.rb', line 21

def invalid(options = {})
  # TODO: Here change the description
  options
end

#missing_value_for(field) ⇒ Object



45
46
47
# File 'lib/rspec-api/fixtures/local.rb', line 45

def missing_value_for(field)
  -> {-1}
end

#unknown(field) ⇒ Object



8
9
10
# File 'lib/rspec-api/fixtures/empty.rb', line 8

def unknown(field)
  # To be overriden
end

#valid(options = {}) ⇒ Object



16
17
18
19
# File 'lib/rspec-api/fixtures/empty.rb', line 16

def valid(options = {})
  # TODO: Here change the description
  options
end