Fix campaign features to work with MySQL
This commit is contained in:
parent
686e41c3d0
commit
9eb4ac2738
2 changed files with 13 additions and 16 deletions
|
|
@ -18,13 +18,13 @@
|
||||||
%tbody
|
%tbody
|
||||||
- @campaigns.each do |campaign|
|
- @campaigns.each do |campaign|
|
||||||
%tr
|
%tr
|
||||||
%td{'id'=> "name_#{campaign.id}"}
|
%td.campaign-name{'id'=> "name_#{campaign.id}"}
|
||||||
= campaign.name
|
= campaign.name
|
||||||
%td{'id'=> "visits_#{campaign.id}"}
|
%td.campaign-visits{'id'=> "visits_#{campaign.id}"}
|
||||||
= campaign.visits_count
|
= campaign.visits_count
|
||||||
%td{'id'=> "registrations_#{campaign.id}"}
|
%td.campaign-registrations{'id'=> "registrations_#{campaign.id}"}
|
||||||
= campaign.registrations_count
|
= campaign.registrations_count
|
||||||
%td{'id'=> "submissions_#{campaign.id}"}
|
%td.campaign-submissions{'id'=> "submissions_#{campaign.id}"}
|
||||||
= campaign.submissions_count
|
= campaign.submissions_count
|
||||||
%td
|
%td
|
||||||
%a.copyLink{'href'=> '#', 'data-url'=>root_path + campaign.url_parameters}
|
%a.copyLink{'href'=> '#', 'data-url'=>root_path + campaign.url_parameters}
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
edit_admin_conference_campaign_path(@conference.short_title, campaign.id),
|
edit_admin_conference_campaign_path(@conference.short_title, campaign.id),
|
||||||
class: 'btn btn-primary'
|
class: 'btn btn-primary'
|
||||||
= link_to 'Delete',
|
= link_to 'Delete',
|
||||||
admin_conference_campaign_path(@conference.short_title, campaign.id),
|
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}?" }
|
method: :delete, class: 'btn btn-danger', data: { confirm: "Do you really want to delete the campaign #{campaign.name}?" }
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= link_to 'New Campaign', new_admin_conference_campaign_path, class: 'btn btn-success pull-right'
|
= link_to 'New Campaign', new_admin_conference_campaign_path, class: 'btn btn-success pull-right'
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@ feature Campaign do
|
||||||
|
|
||||||
click_button 'Create Campaign'
|
click_button 'Create Campaign'
|
||||||
|
|
||||||
expect(flash).
|
expect(flash).to eq("Campaign creation failed. Name can't be blank and Utm campaign can't be blank")
|
||||||
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_name', with: 'Test Campaign'
|
||||||
fill_in 'campaign_utm_campaign', with: 'campaign'
|
fill_in 'campaign_utm_campaign', with: 'campaign'
|
||||||
|
|
@ -30,13 +29,12 @@ feature Campaign do
|
||||||
click_button 'Create Campaign'
|
click_button 'Create Campaign'
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
expect(flash).
|
expect(flash).to eq('Campaign successfully created.')
|
||||||
to eq('Campaign successfully created.')
|
|
||||||
|
|
||||||
expect(find('#name_1').text).to eq('Test Campaign')
|
expect(page).to have_selector('.campaign-name', text: 'Test Campaign')
|
||||||
expect(find('#visits_1').text).to eq('0')
|
expect(page).to have_selector('.campaign-visits', text: '0')
|
||||||
expect(find('#registrations_1').text).to eq('0')
|
expect(page).to have_selector('.campaign-registrations', text: '0')
|
||||||
expect(find('#submissions_1').text).to eq('0')
|
expect(page).to have_selector('.campaign-submissions', text: '0')
|
||||||
|
|
||||||
expect(Campaign.count).to eq(expected_count)
|
expect(Campaign.count).to eq(expected_count)
|
||||||
|
|
||||||
|
|
@ -45,8 +43,7 @@ feature Campaign do
|
||||||
|
|
||||||
fill_in 'campaign_name', with: 'Test Campaign 42'
|
fill_in 'campaign_name', with: 'Test Campaign 42'
|
||||||
click_button 'Update Campaign'
|
click_button 'Update Campaign'
|
||||||
expect(flash).
|
expect(flash).to eq("Campaign 'Test Campaign 42' successfully updated.")
|
||||||
to eq("Campaign 'Test Campaign 42' successfully updated.")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue