Commit 8d6c87ad authored by Alexandre Friquet's avatar Alexandre Friquet
Browse files

Convert specs to RSpec 3.5.4 syntax with Transpec

This conversion is done by Transpec 3.3.0 with the following command:
    transpec

* 705 conversions
    from: obj.should
      to: expect(obj).to

* 292 conversions
    from: == expected
      to: eq(expected)

* 108 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 99 conversions
    from: it { should ... }
      to: it { is_expected.to ... }

* 12 conversions
    from: it { should_not ... }
      to: it { is_expected.not_to ... }

* 12 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 10 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 1 conversion
    from: Klass.any_instance.stub(:message => value)
      to: allow_any_instance_of(Klass).to receive_messages(:message => value)

* 1 conversion
    from: Klass.any_instance.stub(:message)
      to: allow_any_instance_of(Klass).to receive(:message)

* 1 conversion
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 1 conversion
    from: obj.stub_chain(:message1, :message2)
      to: allow(obj).to receive_message_chain(:message1, :message2)

For more details: https://github.com/yujinakayama/transpec#supported-conversions
parent 44a2dc43
......@@ -33,12 +33,12 @@ feature "Manage Activities" do
click_link "Activités"
end
current_path.should == activities_path
expect(current_path).to eq(activities_path)
within "section#content" do
click_link "Nouvelle activité"
end
current_path.should == new_activity_path
expect(current_path).to eq(new_activity_path)
within "form" do
fill_in "Intitulé", with: activity.title
fill_in "Présentation", with: activity.presentation
......@@ -46,12 +46,12 @@ feature "Manage Activities" do
click_create_button
end
current_path.should == activity_path(Activity.first)
expect(current_path).to eq(activity_path(Activity.first))
within "section#content" do
page.should have_content "Activité créée avec succès."
page.should have_selector("h1", text: activity.title)
page.should have_content activity.presentation
page.should have_content activity.description
expect(page).to have_content "Activité créée avec succès."
expect(page).to have_selector("h1", text: activity.title)
expect(page).to have_content activity.presentation
expect(page).to have_content activity.description
end
end
......@@ -64,10 +64,10 @@ feature "Manage Activities" do
end
# page.driver.browser.switch_to.alert.accept
current_path.should == activities_path
expect(current_path).to eq(activities_path)
within "section#content" do
page.should have_content "Activité supprimée avec succès."
page.should_not have_content activity.title
expect(page).to have_content "Activité supprimée avec succès."
expect(page).not_to have_content activity.title
end
end
......@@ -82,16 +82,16 @@ feature "Manage Activities" do
click_edit_link
end
current_path.should == edit_activity_path(@activity)
expect(current_path).to eq(edit_activity_path(@activity))
within "form" do
fill_in "Intitulé", with: new_title
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
within "section#content" do
page.should have_content "Activité mise à jour avec succès."
page.should have_selector("h1", text: new_title)
expect(page).to have_content "Activité mise à jour avec succès."
expect(page).to have_selector("h1", text: new_title)
end
end
......@@ -108,25 +108,25 @@ feature "Manage Activities" do
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
within "section#content" do
page.should have_content "Activité mise à jour avec succès."
expect(page).to have_content "Activité mise à jour avec succès."
end
within "nav#main-nav" do
click_link cat1.title
end
within "section#content" do
page.should_not have_selector("h2", text: @activity.title)
expect(page).not_to have_selector("h2", text: @activity.title)
end
within "nav#main-nav" do
click_link cat2.title
end
within "section#content" do
page.should have_selector("h2", text: @activity.title)
page.should have_content @activity.presentation
page.should_not have_content @activity.description
expect(page).to have_selector("h2", text: @activity.title)
expect(page).to have_content @activity.presentation
expect(page).not_to have_content @activity.description
end
end
......@@ -136,7 +136,7 @@ feature "Manage Activities" do
visit member_group_path member_group
click_link "Trier les clubs"
within "form#members_filter ul#activities_filter" do
page.should have_content @activity.title
expect(page).to have_content @activity.title
end
visit edit_activity_path @activity
......@@ -145,11 +145,11 @@ feature "Manage Activities" do
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
visit member_group_path member_group
click_link "Trier les clubs"
within "form#members_filter ul#activities_filter" do
page.should_not have_content @activity.title
expect(page).not_to have_content @activity.title
end
end
......@@ -161,9 +161,9 @@ feature "Manage Activities" do
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
within "section#content" do
page.should have_selector("img.poster_right")
expect(page).to have_selector("img.poster_right")
end
end
......@@ -172,7 +172,7 @@ feature "Manage Activities" do
@activity.save!
visit activity_path @activity
within "section#content" do
page.should have_selector("img.poster_right")
expect(page).to have_selector("img.poster_right")
end
visit edit_activity_path @activity
......@@ -181,9 +181,9 @@ feature "Manage Activities" do
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
within "section#content" do
page.should_not have_selector("img.poster_right")
expect(page).not_to have_selector("img.poster_right")
end
end
end
......@@ -200,9 +200,9 @@ feature "Manage Activities" do
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
within "section#content dl.attachments" do
page.should have_selector("a", text: attached_file.name)
expect(page).to have_selector("a", text: attached_file.name)
end
end
......@@ -216,8 +216,8 @@ feature "Manage Activities" do
click_button "Mettre à jour"
end
current_path.should == activity_path(@activity)
page.should_not have_selector("dl.attachments")
expect(current_path).to eq(activity_path(@activity))
expect(page).not_to have_selector("dl.attachments")
end
end
......@@ -226,7 +226,7 @@ feature "Manage Activities" do
@activity.activity_categories << cat
visit activity_category_path cat
within "section#content" do
page.should have_selector("h2", text: @activity.title)
expect(page).to have_selector("h2", text: @activity.title)
end
visit edit_activity_path @activity
......@@ -235,14 +235,14 @@ feature "Manage Activities" do
click_update_button
end
current_path.should == activity_path(@activity)
expect(current_path).to eq(activity_path(@activity))
within "section#content" do
page.should have_content "Activité mise à jour avec succès."
expect(page).to have_content "Activité mise à jour avec succès."
end
visit activity_category_path cat
within "section#content" do
page.should_not have_selector("h2", text: @activity.title)
expect(page).not_to have_selector("h2", text: @activity.title)
end
end
end
......@@ -259,15 +259,15 @@ feature "Manage Activities" do
click_link cat.title
end
within "section#content" do
page.should have_selector("h2", text: activity.title)
page.should have_content activity.presentation
page.should_not have_content activity.description
expect(page).to have_selector("h2", text: activity.title)
expect(page).to have_content activity.presentation
expect(page).not_to have_content activity.description
click_link "En savoir plus"
end
within "section#content" do
page.should have_selector("h1", text: activity.title)
page.should have_content activity.presentation
page.should have_content activity.description
expect(page).to have_selector("h1", text: activity.title)
expect(page).to have_content activity.presentation
expect(page).to have_content activity.description
end
end
......@@ -281,14 +281,14 @@ feature "Manage Activities" do
m2 = create :member, published: true, member_groups: [mg1], activities: [foot]
visit activity_path(athle)
within "div#where2practice" do
page.should_not have_link mg2.title
expect(page).not_to have_link mg2.title
click_link mg1.title
end
current_path.should == filter_members_member_group_path(mg1)
expect(current_path).to eq(filter_members_member_group_path(mg1))
within "ul#published_members" do
page.should have_link m1.name
page.should_not have_link m2.name
expect(page).to have_link m1.name
expect(page).not_to have_link m2.name
end
end
end
......
......@@ -36,18 +36,18 @@ feature "Manage Activity Categories" do
click_link "Nouvelle catégorie d'activité"
end
current_path.should == new_activity_category_path
expect(current_path).to eq(new_activity_category_path)
within "form" do
fill_in "Intitulé", with: cat.title
fill_in "Description", with: cat.description
click_create_button
end
current_path.should == activity_category_path(ActivityCategory.first)
expect(current_path).to eq(activity_category_path(ActivityCategory.first))
within "section#content" do
page.should have_content "La catégorie d'activité a été créée avec succès."
page.should have_selector("h1", text: cat.title)
page.should have_content cat.description
expect(page).to have_content "La catégorie d'activité a été créée avec succès."
expect(page).to have_selector("h1", text: cat.title)
expect(page).to have_content cat.description
end
end
......@@ -63,10 +63,10 @@ feature "Manage Activity Categories" do
end
end
current_path.should == activities_path
expect(current_path).to eq(activities_path)
within "section#content" do
page.should have_content "La catégorie d'activité a été supprimée avec succès."
page.should_not have_content cat.title
expect(page).to have_content "La catégorie d'activité a été supprimée avec succès."
expect(page).not_to have_content cat.title
end
end
......@@ -83,16 +83,16 @@ feature "Manage Activity Categories" do
end
end
current_path.should == edit_activity_category_path(cat)
expect(current_path).to eq(edit_activity_category_path(cat))
within "form" do
fill_in "Intitulé", with: new_title
click_update_button
end
current_path.should == activity_category_path(cat.reload)
expect(current_path).to eq(activity_category_path(cat.reload))
within "section#content" do
page.should have_content "La catégorie d'activité a été modifiée avec succès."
page.should have_selector("h1", text: new_title)
expect(page).to have_content "La catégorie d'activité a été modifiée avec succès."
expect(page).to have_selector("h1", text: new_title)
end
end
end
......
......@@ -50,15 +50,15 @@ feature "Authentication" do
click_link "Se connecter"
end
current_path.should == login_path
expect(current_path).to eq(login_path)
within "form#sign_in" do
fill_in :login, with: member.login
fill_in :password, with: default_password
click_button "S'identifier"
end
current_path.should == root_path
page.should have_content "Vous êtes maintenant connecté à la zone membre."
expect(current_path).to eq(root_path)
expect(page).to have_content "Vous êtes maintenant connecté à la zone membre."
end
end
......@@ -68,17 +68,17 @@ feature "Authentication" do
new_pass = 'secret'
login_as(new_member.login, new_member.default_password)
current_path.should == edit_member_path(new_member)
page.should have_content "Vous devez modifier votre mot de passe avant toute chose !"
expect(current_path).to eq(edit_member_path(new_member))
expect(page).to have_content "Vous devez modifier votre mot de passe avant toute chose !"
visit root_path
current_path.should == edit_member_path(new_member)
page.should have_content "Vous devez modifier votre mot de passe avant toute chose !"
expect(current_path).to eq(edit_member_path(new_member))
expect(page).to have_content "Vous devez modifier votre mot de passe avant toute chose !"
change_password
visit root_path
current_path.should == root_path
page.should_not have_content "Vous devez modifier votre mot de passe avant toute chose !"
expect(current_path).to eq(root_path)
expect(page).not_to have_content "Vous devez modifier votre mot de passe avant toute chose !"
end
end
......@@ -92,8 +92,8 @@ feature "Authentication" do
click_link "Se déconnecter"
end
current_path.should == root_path
page.should have_content "Vous êtes maintenant déconnecté de la zone membre."
expect(current_path).to eq(root_path)
expect(page).to have_content "Vous êtes maintenant déconnecté de la zone membre."
end
scenario "I can change my password" do
......@@ -105,13 +105,13 @@ feature "Authentication" do
end
change_password
page.should have_content 'Compte mis à jour avec succès.'
expect(page).to have_content 'Compte mis à jour avec succès.'
logout
login_as(@member.login, new_pass)
current_path.should == root_path
page.should have_content "Vous êtes maintenant connecté à la zone membre."
page.should_not have_content "Vous devez aller sur votre profil pour modifier votre mot de passe!"
expect(current_path).to eq(root_path)
expect(page).to have_content "Vous êtes maintenant connecté à la zone membre."
expect(page).not_to have_content "Vous devez aller sur votre profil pour modifier votre mot de passe!"
end
end
end
......@@ -39,7 +39,7 @@ feature "Use calendar" do
click_link "Calendrier"
end
within "section#content" do
page.should have_content @event.title
expect(page).to have_content @event.title
end
end
......@@ -47,7 +47,7 @@ feature "Use calendar" do
@event.update_attribute(:begin_at, nil)
visit calendar_path(year: 2013, month: 7)
within "section#content" do
page.should_not have_content @event.title
expect(page).not_to have_content @event.title
end
end
......@@ -55,7 +55,7 @@ feature "Use calendar" do
@event.update_attribute(:end_at, nil)
visit calendar_path(year: 2013, month: 7)
within "section#content" do
page.should_not have_content @event.title
expect(page).not_to have_content @event.title
end
end
......@@ -63,17 +63,17 @@ feature "Use calendar" do
@event.update_attribute(:event_type, nil)
visit calendar_path(year: 2013, month: 7)
within "section#content" do
page.should_not have_content @event.title
expect(page).not_to have_content @event.title
end
end
scenario "I can download a PDF version of each month" do
PDFKit.configuration.stub(:wkhtmltopdf).and_return(File.dirname(__FILE__))
PDFKit.any_instance.stub(:to_pdf).and_return(File.new(sample_text_path))
allow(PDFKit.configuration).to receive(:wkhtmltopdf).and_return(File.dirname(__FILE__))
allow_any_instance_of(PDFKit).to receive(:to_pdf).and_return(File.new(sample_text_path))
visit calendar_path(year: 2013, month: 7)
click_link "Télécharger le PDF"
page.response_headers["Content-Type"].should == "application/pdf"
expect(page.response_headers["Content-Type"]).to eq("application/pdf")
end
context "regarding calendar navigation" do
......@@ -89,8 +89,8 @@ feature "Use calendar" do
click_link "août"
end
current_path.should == calendar_path(year: 2013, month: 8)
page.should have_content @event2.title
expect(current_path).to eq(calendar_path(year: 2013, month: 8))
expect(page).to have_content @event2.title
end
scenario "I can go to previous month" do
......@@ -99,8 +99,8 @@ feature "Use calendar" do
click_on "juillet"
end
current_path.should == calendar_path(year: 2013, month: 7)
page.should have_content @event.title
expect(current_path).to eq(calendar_path(year: 2013, month: 7))
expect(page).to have_content @event.title
end
scenario "I can select month and year" do
......@@ -111,8 +111,8 @@ feature "Use calendar" do
click_button "Rafraîchir"
end
current_path.should == calendar_path(year: 2014, month: 2)
page.should have_content @event3.title
expect(current_path).to eq(calendar_path(year: 2014, month: 2))
expect(page).to have_content @event3.title
end
scenario "I can choose which event types to show" do
......@@ -122,8 +122,8 @@ feature "Use calendar" do
click_button "Rafraîchir"
end
current_path.should == calendar_path(year: 2013, month: 7)
page.should_not have_content @event.title
expect(current_path).to eq(calendar_path(year: 2013, month: 7))
expect(page).not_to have_content @event.title
end
end
end
......
......@@ -36,16 +36,16 @@ feature "Manage contact types" do
click_link "Types de contact"
click_link "Nouveau type de contact"
current_path.should == new_contact_type_path
expect(current_path).to eq(new_contact_type_path)
within "form" do
fill_in "Intitulé", with: type.title
click_create_button
end
current_path.should == contact_types_path
expect(current_path).to eq(contact_types_path)
within "section#content" do
page.should have_content "Type de contact créé avec succès"
page.should have_content type.title
expect(page).to have_content "Type de contact créé avec succès"
expect(page).to have_content type.title
end
end
......@@ -58,16 +58,16 @@ feature "Manage contact types" do
click_edit_link
end
current_path.should == edit_contact_type_path(type)
expect(current_path).to eq(edit_contact_type_path(type))
within "form" do
fill_in "Intitulé", with: new_title
click_update_button
end
current_path.should == contact_types_path
expect(current_path).to eq(contact_types_path)
within "section#content" do
page.should have_content "Type de contact mis à jour avec succès"
page.should have_content new_title
expect(page).to have_content "Type de contact mis à jour avec succès"
expect(page).to have_content new_title
end
end
......@@ -80,10 +80,10 @@ feature "Manage contact types" do
click_delete_link
end
current_path.should == contact_types_path
expect(current_path).to eq(contact_types_path)
within "section#content" do
page.should have_content "Type de contact supprimé avec succès"
page.should_not have_content type.title
expect(page).to have_content "Type de contact supprimé avec succès"
expect(page).not_to have_content type.title
end
end
end
......
......@@ -34,8 +34,8 @@ feature "ContactUS mails" do
click_link "Nous contacter"
end
current_path.should == new_contact_us_path
page.should_not have_selector "form"
expect(current_path).to eq(new_contact_us_path)
expect(page).not_to have_selector "form"
end
end
......@@ -46,7 +46,7 @@ feature "ContactUS mails" do
click_link "Nous contacter"
end
current_path.should == new_contact_us_path
expect(current_path).to eq(new_contact_us_path)
within "form" do
fill_in "Nom", with: "Dupont"
fill_in "Prénom", with: "Jean"
......@@ -57,8 +57,8 @@ feature "ContactUS mails" do
click_button "Envoyer"
end
current_path.should == root_path
page.should have_content "Votre email a été envoyé avec succès."
expect(current_path).to eq(root_path)
expect(page).to have_content "Votre email a été envoyé avec succès."
end
scenario "I can see errors when form not properly filled in" do
......@@ -67,13 +67,13 @@ feature "ContactUS mails" do
click_button "Envoyer"
end
current_path.should == contact_us_path
page.should have_selector("span.error", text: "doit être rempli(e)")
expect(current_path).to eq(contact_us_path)
expect(page).to have_selector("span.error", text: "doit être rempli(e)")
end
scenario "I am informed if an error occured while sending off the email" do
#Given
Mailer.stub_chain(:contact_us, :deliver).and_raise("Error")
allow(Mailer).to receive_message_chain(:contact_us, :deliver).and_raise("Error")
# When
visit new_contact_us_path
within "form" do
......@@ -86,8 +86,8 @@ feature "ContactUS mails" do
click_button "Envoyer"
end
# Then
current_path.should == contact_us_path
page.should have_content "Nous n'avons pu envoyer votre email pour une raison quelconque. Merci d'essayer un peu plus tard. Si le problème persiste, merci de nous contacter par téléphone."
expect(current_path).to eq(contact_us_path)
expect(page).to have_content "Nous n'avons pu envoyer votre email pour une raison quelconque. Merci d'essayer un peu plus tard. Si le problème persiste, merci de nous contacter par téléphone."
end
end
end
......
......@@ -52,12 +52,12 @@ feature "Manage Emails" do
click_link "Emails"
end
current_path.should == emails_path
expect(current_path).to eq(emails_path)
within "section#content" do
click_link "Nouvel email"
end
current_path.should == new_email_path
expect(current_path).to eq(new_email_path)
within "form" do
fill_in_common_things
find("h3", text: "Information").click
......@@ -68,13 +68,13 @@ feature "Manage Emails" do
click_create_button
end
current_path.should == email_path(Email.first)
expect(current_path).to eq(email_path(Email.first))