}.gsub(/\s+/, ' ').strip.gsub('> <', '><')
end
before do
allow(Time.zone).to receive(:now).and_return(Time.zone.parse('Feb 19 1986'))
InvisibleCaptcha.visual_honeypots = false
InvisibleCaptcha.timestamp_enabled = true
end
it 'with no arguments' do
InvisibleCaptcha.honeypots = [:foo_id]
expect(invisible_captcha).to eq(helper_output)
end
it 'with specific honeypot' do
expect(invisible_captcha(:subtitle)).to eq(helper_output(:subtitle))
end
it 'with specific honeypot and scope' do
expect(invisible_captcha(:subtitle, :topic)).to eq(helper_output(:subtitle, :topic))
end
context "honeypot visibilty" do
it 'visible from defaults' do
InvisibleCaptcha.honeypots = [:foo_id]
InvisibleCaptcha.visual_honeypots = true
expect(invisible_captcha).to eq(helper_output)
end
it 'visible from given instance (default override)' do
InvisibleCaptcha.honeypots = [:foo_id]
expect(invisible_captcha(visual_honeypots: true)).to eq(helper_output(nil, nil, visual_honeypots: true))
end
it 'invisible from given instance (default override)' do
InvisibleCaptcha.honeypots = [:foo_id]
InvisibleCaptcha.visual_honeypots = true
expect(invisible_captcha(visual_honeypots: false)).to eq(helper_output(nil, nil, visual_honeypots: false))
end
end
it 'should set spam timestamp' do
InvisibleCaptcha.honeypots = [:foo_id]
invisible_captcha
expect(session[:invisible_captcha_timestamp]).to eq(Time.zone.now.iso8601)
end
end