41 lines
964 B
Ruby
41 lines
964 B
Ruby
require 'spec_helper'
|
|
|
|
describe ApiSignupHintsController, :type=>:controller do
|
|
render_views
|
|
|
|
let(:user) {AnonymousUser.new(SecureRandom.uuid, {})}
|
|
|
|
before(:each) do
|
|
SignupHint.delete_all
|
|
controller.anonymous_user = user
|
|
end
|
|
|
|
it "creates" do
|
|
post :create, {format: :json}
|
|
|
|
response.should be_success
|
|
body = JSON.parse(response.body)
|
|
body["id"].should_not be_nil
|
|
|
|
SignupHint.count.should eq(1)
|
|
end
|
|
|
|
it "updates" do
|
|
post :create, {format: :json, redirect_location: 'hi'}
|
|
|
|
response.should be_success
|
|
body = JSON.parse(response.body)
|
|
body["redirect_location"].should eq('hi')
|
|
body["want_jamblaster"].should eq(false)
|
|
|
|
post :create, {format: :json, redirect_location: 'bye', want_jamblaster: true}
|
|
|
|
response.should be_success
|
|
body = JSON.parse(response.body)
|
|
body["redirect_location"].should eq('bye')
|
|
body["want_jamblaster"].should eq(true)
|
|
|
|
SignupHint.count.should eq(1)
|
|
end
|
|
end
|