Sha256: f9be0e2a182a91d4f8a87d062220c327c8cf32c38f72a9026ff8efd7291b828b
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' describe Capybara::Flow do ExpectedUserActions = [ :attach_file, :check, :choose, :click_button, :click_link, :click_link_or_button, :click_on, # :evaluate_script, #BAD FOR PERCY :execute_script, :fill_in, :go_back, :go_forward, :unselect, :visit, ] class Dummy ExpectedUserActions.each do |lazy| define_method lazy do |*args, &block| instance_variable_set("@#{lazy}", true) end define_method "#{lazy}?" do |*args, &block| !!instance_variable_get("@#{lazy}") end end end it 'should have a version number' do expect(Capybara::Flow::VERSION).to_not be_nil end context "included into a class" do let(:described_class) { Dummy.send(:include, Capybara::Flow) } context "the instance" do subject { described_class.new } it "should have an EmptyRecorder set to recorder" do expect(subject.recorder).to be_a(Capybara::Flow::EmptyRecorder) end it "should be able to set a recorder" do expect do subject.recorder = :foo end.to change { subject.recorder } end context "should add itself to the recorder" do ExpectedUserActions.each do |attribute| it "for #{attribute}" do expect(subject.recorder).to receive(:add).with(subject) subject.send(attribute) end it "and still call the original #{attribute}" do expect do subject.send(attribute) end.to change { subject.send"#{attribute}?" } end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-flow-0.2.2 | spec/capybara/flow_spec.rb |