spec/pushpad/notification_spec.rb in pushpad-0.11.0 vs spec/pushpad/notification_spec.rb in pushpad-0.11.1
- old
+ new
@@ -5,38 +5,38 @@
let!(:auth_token) { Pushpad.auth_token = "abc123" }
let!(:project_id) { Pushpad.project_id = 123 }
let(:notification) { Pushpad::Notification.new body: "Example message" }
def stub_notification_get(attributes)
- stub_request(:get, "https://pushpad.xyz/notifications/#{attributes[:id]}").
+ stub_request(:get, "https://pushpad.xyz/api/v1/notifications/#{attributes[:id]}").
to_return(status: 200, body: attributes.to_json)
end
def stub_failing_notification_get(notification_id)
- stub_request(:get, "https://pushpad.xyz/notifications/#{notification_id}").
+ stub_request(:get, "https://pushpad.xyz/api/v1/notifications/#{notification_id}").
to_return(status: 404)
end
def stub_notifications_get(options)
- stub_request(:get, "https://pushpad.xyz/projects/#{options[:project_id]}/notifications").
+ stub_request(:get, "https://pushpad.xyz/api/v1/projects/#{options[:project_id]}/notifications").
with(query: hash_including(options.fetch(:query, {}))).
to_return(status: 200, body: options[:list].to_json)
end
def stub_failing_notifications_get(options)
- stub_request(:get, "https://pushpad.xyz/projects/#{options[:project_id]}/notifications").
+ stub_request(:get, "https://pushpad.xyz/api/v1/projects/#{options[:project_id]}/notifications").
to_return(status: 403)
end
def stub_notification_post(project_id, params = {}, response_body = "{}")
- stub_request(:post, "https://pushpad.xyz/projects/#{project_id}/notifications").
+ stub_request(:post, "https://pushpad.xyz/api/v1/projects/#{project_id}/notifications").
with(body: hash_including(params)).
to_return(status: 201, body: response_body)
end
def stub_failing_notification_post(project_id)
- stub_request(:post, "https://pushpad.xyz/projects/#{project_id}/notifications").
+ stub_request(:post, "https://pushpad.xyz/api/v1/projects/#{project_id}/notifications").
to_return(status: 403)
end
describe ".new" do
it "allows delivering notifications even if an id attribute is supplied" do