Sha256: df21afbd2cba47c2a3adda86f90b981c0845da6a99484ea222b7037ac820f2c3

Contents?: true

Size: 1.62 KB

Versions: 20

Compression:

Stored size: 1.62 KB

Contents

Given(/^[Cc]lient call route ["'](.+)["']$/) do |route|
  @handler_helper.request(route)
end

Given(/^[Ss]erver should response ["'](.+)["'] as ["'](.+)["']$/) do |response_key, expected_value|
  response_value = @handler_helper.response.dig(*response_key.split('.').map(&:to_sym))

  expect(response_value.to_s).to eq(expected_value)
end

Given(/^[Ss]erver should response the following json[:]*$/) do |expected_json|
  expected_json = JSON.generate(JSON.parse(expected_json.strip))
  response_json = JSON.generate(@handler_helper.response)

  expect(response_json).to eq(expected_json)
end

Given(/^[Ss]etup key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
  @handler_helper.add_setup(key, value)
end

Given(/^[Cc]onfig key ["'](.+)["'] is ["'](.+)["']$/) do |key, value|
  @handler_helper.add_config(key, value)
end

Given(/^[Cc]onfig is the following json[:]*$/) do |config_json|
  config = JSON.parse(config_json)
  @handler_helper.set_config(config)
end

Given(/^[Pp]rint server response$/) do 
  puts "response: #{@handler_helper.response}"
end

Given(/^(?:[Nn]ow\s)?[Tt]oday is ["'](.+)["']$/) do |date_text|
  time_now = date_text.to_time

  Time.stub(:now).and_return(time_now)
end

Given(/^[Tt]he [Uu]ser ["'](.+)["'] is authenticated$/) do |user_id|
  @handler_helper.authenticate(user_id)
end

Given(/^[Tt]he following [Uu]ser[s]*[:]*$/) do |table|
  table.hashes.each do |table_hash|
    User.create(id: table_hash[:user_id])
  end
end

Before do
  ActiveRecord::Base.descendants.each { |c| c.delete_all unless c == ActiveRecord::SchemaMigration }
  @handler_helper = RubyPitaya::HandlerSpecHelperClass.new('cucumber')
end

# After do
# end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rubypitaya-2.27.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.26.3 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.26.2 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.26.1 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.26.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.25.1 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.25.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.24.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.23.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.22.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.21.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.20.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.19.1 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.19.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.18.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.17.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.16.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.15.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.14.1 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb
rubypitaya-2.14.0 ./lib/rubypitaya/app-template/features/step_definitions/rubypitaya_steps.rb