Files
dunlop-core/spec/services/dunlop/state_badge_spec.rb
T
2018-01-20 13:02:44 -03:00

24 lines
1.0 KiB
Ruby

require 'rails_helper'
#describe Dunlop::StateBadge, type: :helper do
describe Dunlop::ApplicationHelper, type: :helper do
let(:arguments) { {context: helper, target: target, options: {}} }
let(:target) { build :workflow_instance_scenario1, :active, id: 987 }
subject { Dunlop::StateBadge.new(arguments[:context], arguments[:target], arguments[:options]) }
it "shows the default html" do
subject.html.should eq <<-HTML.strip_heredoc.split("\n").map(&:strip).join
<span class="display-badge workflow_instance scenario1 active" data-id="987" data-resource="workflow_instance/scenario1" data-state="active">
<span class="pre-display"></span><span class="badge-name">WI</span>
<span class="human-state">Actief</span>
<span class="post-display"></span>
</span>
HTML
end
it "adds linkt_to as target if given" do
arguments[:options][:link_to] = "/smart_url?q[state_eq]=my_state"
subject.html.should include 'data-target="/smart_url?q[state_eq]=my_state"'
end
end