ref: dockerize
plugins/push_notification/features/step_definitions/push_notification_steps.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
Given /^the following notifications$/ do |table| settings = {} table.hashes.each do |item| settings[item[:name]] = "1" end data = {:notifications => settings} server_settings = Noosfero::Plugin::Settings.new(Environment.default, PushNotificationPlugin, data) server_settings.save! end Given /^that the user ([^\"]*) has the following devices$/ do |user_name,table| user = User.find_by(:login => user_name) table.hashes.each do |item| PushNotificationPlugin::DeviceToken.create(:user => user, :token => item[:token], :device_name => item[:name]) end end Given /^that the user ([^\"]*) has the following notifications$/ do |user_name,table| user = User.find_by(:login => user_name) table.hashes.each do |item| user.notification_settings.activate_notification item[:name] end user.save! end Given /^that "([^\"]*)" is the server api key$/ do |key| data = {:server_api_key => key} server_settings = Noosfero::Plugin::Settings.new(Environment.default, PushNotificationPlugin, data) server_settings.save! end |