Sha256: 588e1d589a1af4f11864d3be6688f61a56a9722394bdc569aff36f1ee512358a

Contents?: true

Size: 1.95 KB

Versions: 5

Compression:

Stored size: 1.95 KB

Contents

$instances = Hash.new(0)

Given(/^I initialize the gem$/) do
	$instances = Hash.new(0)
	`rm -f #{Odania::Plugin::INSTANCE_FILES_PATH}*`

	Odania.plugin.get_all.each_pair do |name, instances|
		instances.each do |instance|
			if instance.ServiceName.start_with? 'test-plugin'
				$logger.info "Deregister: #{instance}" if $debug
				Odania.plugin.deregister instance.ServiceID
			end
		end
	end
end

Given(/^I registered the plugin "([^"]*)"$/) do |plugin_name|
	plugin_cfg = {
		'name' => plugin_name,
		'ip' => '127.0.0.1',
		'port' => 80,
		'tags' => ["plugin-#{plugin_name}"],
		'domains' => {
			'odania.com' => {
				'contents' => {
				},
				'assets' => {
				},
				'config' => {
					'asset_url' => 'assets.odania.com',
					'languages' => %w(de en),
					'layout' => 'simple',
					'language_selector' => 'prefix',
					'redirects' => {
						'^/test' => '/games'
					}
				},
				'public_pages' => {
				}
			}
		},
		'layouts' => {
		}
	}

	$instances[plugin_name] += 1
	plugin_instance_name = "#{plugin_name}_#{$instances[plugin_name]}"
	Odania.plugin.register plugin_instance_name, plugin_cfg
end

Then(/^I should see "([^"]*)" instances of the plugin "([^"]*)"$/) do |amount, plugin_name|
	plugins = Odania.plugin.get_all
	expect(plugins[plugin_name].count).to eq(amount.to_i)
end

When(/^I retrieve plugin instance name for "([^"]*)"$/) do |plugin_name|
	@plugin_instance_name = Odania.plugin.get_plugin_instance_name plugin_name
end

Then(/^I should retrieve "([^"]*)"$/) do |plugin_instance_name|
	expect(plugin_instance_name).to eq(@plugin_instance_name)
end

When(/^I generate the joined plugin config$/) do
	Odania.plugin.plugin_config.load_from_consul
	Odania.plugin.plugin_config.generate
end

Then(/^I have a joined plugin config$/) do
	pending # Write code here that turns the phrase above into concrete actions
end

Then(/^The joined plugin config contains the plugin "([^"]*)"$/) do |arg1|
	pending # Write code here that turns the phrase above into concrete actions
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
odania-0.1.0 features/step_definitions/plugin_steps.rb
odania-0.0.39 features/step_definitions/plugin_steps.rb
odania-0.0.38 features/step_definitions/plugin_steps.rb
odania-0.0.37 features/step_definitions/plugin_steps.rb
odania-0.0.36 features/step_definitions/plugin_steps.rb