Sha256: 69020ccba348ca52f6506a39aa15fb6999b5286414f7b479d9b28a73fd945438

Contents?: true

Size: 1.76 KB

Versions: 11

Compression:

Stored size: 1.76 KB

Contents

require 'net/http'
require 'time'

When /^I have a valid project on localeapp\.com with api key "([^"]*)"$/ do |api_key|
  uri = "https://api.localeapp.com/v1/projects/#{api_key}.json"
  body = valid_project_data.to_json
  add_fake_web_uri(:get, uri, ['200', 'OK'], body)
  add_fake_web_uri(:post, "https://api.localeapp.com/v1/projects/#{api_key}/import/", ['202', 'OK'], '')
  add_fake_web_uri(:post, "https://api.localeapp.com/v1/projects/#{api_key}/translations/missing.json", ["202", "OK"], '')
end

When /^I have a valid project on localeapp\.com but an incorrect api key "([^"]*)"$/ do |bad_api_key|
  uri = "https://api.localeapp.com/v1/projects/#{bad_api_key}.json"
  body = valid_project_data.to_json
  add_fake_web_uri(:get, uri, ['404', 'Not Found'], body)
end

When /^I have a translations on localeapp\.com for the project with api key "([^"]*)"$/ do |api_key|
  uri = "https://api.localeapp.com/v1/projects/#{api_key}/translations.yml"
  body = valid_translation_data.to_yaml
  add_fake_web_uri(:get, uri, ['200', 'OK'], body)
end

When /^new translations for the api key "([^"]*)" since "([^"]*)" with time "([^"]*)"$/ do |api_key, update_time, new_time|
  uri = "https://api.localeapp.com/v1/projects/#{api_key}/translations.yml?updated_at=#{update_time}"
  body = valid_translation_data.to_yaml
  add_fake_web_uri(:get, uri, ['200', 'OK'], body, 'date' => Time.at(new_time.to_i).httpdate)
end

When /^an initializer file$/ do
  steps %Q{
    And a file named "config/initializers/localeapp.rb" with:
    """
    require 'localeapp/rails'
    Localeapp.configure do |config|
      config.api_key = 'MYAPIKEY'
    end
    """
  }
end

When /^help should not be displayed$/ do
  steps %Q{
    And the output should not contain:
    """
    Usage: localeapp COMMAND [options]
    """
  }
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
localeapp-0.6.2 features/step_definitions/cli_steps.rb
localeapp-0.6.1 features/step_definitions/cli_steps.rb
localeapp-0.6.0 features/step_definitions/cli_steps.rb
localeapp-0.5.2 features/step_definitions/cli_steps.rb
localeapp-0.5.1 features/step_definitions/cli_steps.rb
localeapp-0.5.0 features/step_definitions/cli_steps.rb
localeapp-0.4.3 features/step_definitions/cli_steps.rb
localeapp-0.4.2 features/step_definitions/cli_steps.rb
localeapp-0.4.1 features/step_definitions/cli_steps.rb
localeapp-0.4.0 features/step_definitions/cli_steps.rb
localeapp-0.3.2 features/step_definitions/cli_steps.rb