Sha256: 3e264ae2ab7d88862be46da32fff83a8db925fe12948c15eadf71ef0823f8eec

Contents?: true

Size: 886 Bytes

Versions: 10

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

include Neutral::VotingBuilder::Elements

describe Link, type: :feature do
  let(:vote) { FactoryGirl.create(:vote) }

  [Link::Positive, Link::Negative, Link::Remove].each do |link|
    describe link do
      let(:klass) { link.to_s.demodulize.downcase }
      let(:router) { Neutral::VotingBuilder::Router.new(vote).send(klass) }
      let(:icon) { "fa-#{klass}" }

      subject { Capybara.string link.new(router, icon).to_s }

      it { should have_selector("a.#{klass}") }

      it "has corresponding path" do
        subject.find("a.#{klass}")[:href].should include(router[:path])
      end

      it "has corresponding HTTP method" do
        subject.find("a.#{klass}")["data-method"].should == router[:method]
      end

      it "has valid FontAwesome icon class" do
        subject.find("i")[:class].should == "fa #{icon}"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
neutral-0.0.10 spec/voting_builder/elements/link_spec.rb
neutral-0.0.9 spec/voting_builder/elements/link_spec.rb
neutral-0.0.8 spec/voting_builder/elements/link_spec.rb
neutral-0.0.7 spec/voting_builder/elements/link_spec.rb
neutral-0.0.6 spec/voting_builder/elements/link_spec.rb
neutral-0.0.5 spec/voting_builder/elements/link_spec.rb
neutral-0.0.4 spec/voting_builder/elements/link_spec.rb
neutral-0.0.3 spec/voting_builder/elements/link_spec.rb
neutral-0.0.2 spec/voting_builder/elements/link_spec.rb
neutral-0.0.1 spec/voting_builder/elements/link_spec.rb