Skip to content

Instantly share code, notes, and snippets.

@r00k
Last active December 15, 2015 11:49
Show Gist options
  • Save r00k/5256238 to your computer and use it in GitHub Desktop.
Save r00k/5256238 to your computer and use it in GitHub Desktop.
<%= state.commission_name %>
<%= state.commission_homepage_url %>
<%= render 'state_comparison/state', state: @state_1 %>
<%= render 'state_comparison/state', state: @state_2 %>
require 'spec_helper'
describe 'rendering the state compare view' do
it 'displays both commission names' do
state_1 = build_stubbed(:state, commission_name: 'ABC')
state_2 = build_stubbed(:state, commission_name: 'XYZ')
assign(:state_1, state_1)
assign(:state_2, state_2)
render template: 'state_comparison/show'
expect(rendered).to include(state_1.commission_name)
expect(rendered).to include(state_2.commission_name)
end
it 'displays both commission websites' do
state_1 = build_stubbed(:state, commission_homepage_url: 'http://state1.gov')
state_2 = build_stubbed(:state, commission_homepage_url: 'http://state2.gov')
assign(:state_1, state_1)
assign(:state_2, state_2)
render template: 'state_comparison/show'
expect(rendered).to include(state_1.commission_homepage_url)
expect(rendered).to include(state_2.commission_homepage_url)
end
it 'displays the number of commissioners for each state' do
state_1 = build_stubbed(:state, commissioner_count: 1)
state_2 = build_stubbed(:state, commissioner_count: 2)
assign(:state_1, state_1)
assign(:state_2, state_2)
render template: 'state_comparison/show'
expect(rendered).to include(state_1.commissioner_count.to_s)
expect(rendered).to include(state_2.commissioner_count.to_s)
end
it 'displays the commissioner selection method' do
state_1 = build_stubbed(:state, commissioner_selection_method: 'Elected')
state_2 = build_stubbed(:state, commissioner_selection_method: 'Appointed')
assign(:state_1, state_1)
assign(:state_2, state_2)
render template: 'state_comparison/show'
expect(rendered).to include(state_1.commissioner_selection_method)
expect(rendered).to include(state_2.commissioner_selection_method)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment