Sha256: f1eca5b741c34fe9d81eaae1bf69603331d9de58c2f63a221488593df3863288

Contents?: true

Size: 1.76 KB

Versions: 4

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/all.yml"
  body = valid_export_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

4 entries across 4 versions & 1 rubygems

Version Path
localeapp-0.6.6 features/step_definitions/cli_steps.rb
localeapp-0.6.5 features/step_definitions/cli_steps.rb
localeapp-0.6.4 features/step_definitions/cli_steps.rb
localeapp-0.6.3 features/step_definitions/cli_steps.rb