Fix campaign features to work with MySQL

This commit is contained in:
Hernan Schmidt 2016-08-18 13:23:48 +02:00 committed by Hernán Schmidt
parent 686e41c3d0
commit 9eb4ac2738
2 changed files with 13 additions and 16 deletions

View file

@ -18,13 +18,13 @@
%tbody
- @campaigns.each do |campaign|
%tr
%td{'id'=> "name_#{campaign.id}"}
%td.campaign-name{'id'=> "name_#{campaign.id}"}
= campaign.name
%td{'id'=> "visits_#{campaign.id}"}
%td.campaign-visits{'id'=> "visits_#{campaign.id}"}
= campaign.visits_count
%td{'id'=> "registrations_#{campaign.id}"}
%td.campaign-registrations{'id'=> "registrations_#{campaign.id}"}
= campaign.registrations_count
%td{'id'=> "submissions_#{campaign.id}"}
%td.campaign-submissions{'id'=> "submissions_#{campaign.id}"}
= campaign.submissions_count
%td
%a.copyLink{'href'=> '#', 'data-url'=>root_path + campaign.url_parameters}
@ -35,8 +35,8 @@
edit_admin_conference_campaign_path(@conference.short_title, campaign.id),
class: 'btn btn-primary'
= link_to 'Delete',
admin_conference_campaign_path(@conference.short_title, campaign.id),
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the campaign #{campaign.name}?" }
admin_conference_campaign_path(@conference.short_title, campaign.id),
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the campaign #{campaign.name}?" }
.row
.col-md-12
= link_to 'New Campaign', new_admin_conference_campaign_path, class: 'btn btn-success pull-right'

View file

@ -17,8 +17,7 @@ feature Campaign do
click_button 'Create Campaign'
expect(flash).
to eq("Campaign creation failed. Name can't be blank and Utm campaign can't be blank")
expect(flash).to eq("Campaign creation failed. Name can't be blank and Utm campaign can't be blank")
fill_in 'campaign_name', with: 'Test Campaign'
fill_in 'campaign_utm_campaign', with: 'campaign'
@ -30,13 +29,12 @@ feature Campaign do
click_button 'Create Campaign'
# Validations
expect(flash).
to eq('Campaign successfully created.')
expect(flash).to eq('Campaign successfully created.')
expect(find('#name_1').text).to eq('Test Campaign')
expect(find('#visits_1').text).to eq('0')
expect(find('#registrations_1').text).to eq('0')
expect(find('#submissions_1').text).to eq('0')
expect(page).to have_selector('.campaign-name', text: 'Test Campaign')
expect(page).to have_selector('.campaign-visits', text: '0')
expect(page).to have_selector('.campaign-registrations', text: '0')
expect(page).to have_selector('.campaign-submissions', text: '0')
expect(Campaign.count).to eq(expected_count)
@ -45,8 +43,7 @@ feature Campaign do
fill_in 'campaign_name', with: 'Test Campaign 42'
click_button 'Update Campaign'
expect(flash).
to eq("Campaign 'Test Campaign 42' successfully updated.")
expect(flash).to eq("Campaign 'Test Campaign 42' successfully updated.")
end
end