From 981c798e60fc0753c7db9ca1343a49a80a4b54e3 Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 00:23:47 -0700 Subject: [PATCH 1/8] [feat] show alert when user has 0 ticket purchases --- app/views/conferences/_header.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index 9a1316f6..ed3edeff 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,6 +1,10 @@ - cache [conference, venue, '#splash#header'] do #banner{ style: ("background-image: url(#{conference.picture_url})" if conference.picture_url) } .container + - if current_user.ticket_purchases.by_conference(@conference).empty? + .alert.bg-info{:role => "alert", :style => "margin-bottom: 100px"} + You have not registered for any event yet. + = link_to "Register now!", "#tickets" .row .col-md-6.col-md-offset-3{ id: (conference.picture? ? "header-image" : "header-no-image") } .row From c9721aa4f9f63a822bc816c269c12a0854f2a48d Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 01:04:05 -0700 Subject: [PATCH 2/8] changes to the feature --- app/views/conferences/_header.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index ed3edeff..5b051f16 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,10 +1,11 @@ - cache [conference, venue, '#splash#header'] do #banner{ style: ("background-image: url(#{conference.picture_url})" if conference.picture_url) } .container - - if current_user.ticket_purchases.by_conference(@conference).empty? - .alert.bg-info{:role => "alert", :style => "margin-bottom: 100px"} - You have not registered for any event yet. - = link_to "Register now!", "#tickets" + - if user_signed_in? + - if current_user.ticket_purchases.by_conference(@conference).empty? + .alert.bg-info{:role => "alert", :style => "margin-bottom: 100px"} + You have not purchased any tickets for this conference yet. + = link_to "Book you tickets now!", "#tickets" .row .col-md-6.col-md-offset-3{ id: (conference.picture? ? "header-image" : "header-no-image") } .row From 1318930ab86d694b93531b79aa79e69d3cc5594e Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 01:04:17 -0700 Subject: [PATCH 3/8] added tests --- spec/features/splashpage_spec.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 7b9b8866..9306e8b0 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -164,4 +164,35 @@ feature Splashpage do expect(happening_now).to have_content(event_schedule4.event.title) end end + + context 'clarify registration status' do + let!(:splashpage) { create(:splashpage, conference: conference, public: true)} + let!(:ticket_1) { create(:ticket) } + let!(:free_ticket) { create(:ticket, price_cents: 0) } + + scenario 'user signed in with no tickets', feature: true do + sign_in participant + visit conference_path(conference.short_title) + expect(page).to have_content ("You have not purchased any tickets for this conference yet.") + end + + scenario 'user signed in with 1 free ticket', feature: true do + sign_in participant + purchase = create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) + visit conference_path(conference.short_title) + expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + end + + scenario 'user signed in with 1 paid ticket', feature: true do + sign_in participant + purchase = create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) + visit conference_path(conference.short_title) + expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + end + + scenario 'user not signed in', feature: true do + visit conference_path(conference.short_title) + expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + end + end end From c635ccfbaf2ae3641cead89b1b0c62366ac4f17e Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 01:05:57 -0700 Subject: [PATCH 4/8] addition test --- spec/features/splashpage_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index 9306e8b0..f0c7d997 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -190,6 +190,14 @@ feature Splashpage do expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") end + scenario 'user signed in with multiple ticket', feature: true do + sign_in participant + purchase1 = create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) + purchase2 = create(:ticket_purchase, conference: conference, user: participant, ticket: free_ticket, quantity: 1) + visit conference_path(conference.short_title) + expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + end + scenario 'user not signed in', feature: true do visit conference_path(conference.short_title) expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") From a754f6040a79d7b792f32482116e5af44982ee73 Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 01:15:55 -0700 Subject: [PATCH 5/8] rubocop/linter fixes --- spec/features/splashpage_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/features/splashpage_spec.rb b/spec/features/splashpage_spec.rb index f0c7d997..d5810ca7 100644 --- a/spec/features/splashpage_spec.rb +++ b/spec/features/splashpage_spec.rb @@ -173,34 +173,34 @@ feature Splashpage do scenario 'user signed in with no tickets', feature: true do sign_in participant visit conference_path(conference.short_title) - expect(page).to have_content ("You have not purchased any tickets for this conference yet.") + expect(page).to have_content 'You have not purchased any tickets for this conference yet.' end scenario 'user signed in with 1 free ticket', feature: true do sign_in participant - purchase = create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) + create(:ticket_purchase, conference: conference, user: participant, ticket: free_ticket, quantity: 1) visit conference_path(conference.short_title) - expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + expect(page).not_to have_content 'You have not purchased any tickets for this conference yet.' end scenario 'user signed in with 1 paid ticket', feature: true do sign_in participant - purchase = create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) + create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) visit conference_path(conference.short_title) - expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + expect(page).not_to have_content 'You have not purchased any tickets for this conference yet.' end scenario 'user signed in with multiple ticket', feature: true do sign_in participant - purchase1 = create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) - purchase2 = create(:ticket_purchase, conference: conference, user: participant, ticket: free_ticket, quantity: 1) + create(:ticket_purchase, conference: conference, user: participant, ticket: ticket_1, quantity: 1) + create(:ticket_purchase, conference: conference, user: participant, ticket: free_ticket, quantity: 1) visit conference_path(conference.short_title) - expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + expect(page).not_to have_content 'You have not purchased any tickets for this conference yet.' end scenario 'user not signed in', feature: true do visit conference_path(conference.short_title) - expect(page).not_to have_content ("You have not purchased any tickets for this conference yet.") + expect(page).not_to have_content 'You have not purchased any tickets for this conference yet.' end end end From b450abddd17de76f6eae6924f3f34ad4690913de Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 01:43:31 -0700 Subject: [PATCH 6/8] linter changes --- app/views/conferences/_header.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index 5b051f16..817345d9 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,10 +1,10 @@ - cache [conference, venue, '#splash#header'] do #banner{ style: ("background-image: url(#{conference.picture_url})" if conference.picture_url) } .container - - if user_signed_in? + - if user_signed_in? - if current_user.ticket_purchases.by_conference(@conference).empty? - .alert.bg-info{:role => "alert", :style => "margin-bottom: 100px"} - You have not purchased any tickets for this conference yet. + .alert.bg-info{ :role => "alert", :style => "margin-bottom: 100px" } + You have not purchased any tickets for this conference yet. = link_to "Book you tickets now!", "#tickets" .row .col-md-6.col-md-offset-3{ id: (conference.picture? ? "header-image" : "header-no-image") } From 4478bef67d9636adb79990fc6508b6c954dd565c Mon Sep 17 00:00:00 2001 From: rajavi-mishra Date: Fri, 30 Apr 2021 01:49:10 -0700 Subject: [PATCH 7/8] hariki, dependencies, pronto --- Gemfile.lock | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 52965d29..24bc65a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -171,11 +171,15 @@ GEM railties (>= 3.0.0) faker (1.9.3) i18n (>= 0.7) - faraday (1.3.0) + faraday (1.4.1) + faraday-excon (~> 1.1) faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) multipart-post (>= 1.2, < 3) - ruby2_keywords + ruby2_keywords (>= 0.0.4) + faraday-excon (1.1.0) faraday-net_http (1.0.1) + faraday-net_http_persistent (1.1.0) fastimage (2.1.4) feature (1.4.0) ffi (1.10.0) @@ -293,7 +297,7 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) - mimemagic (0.4.3) + mimemagic (0.3.10) nokogiri (~> 1) rake mina (1.2.3) @@ -301,7 +305,7 @@ GEM rake mini_magick (4.9.5) mini_mime (1.0.3) - mini_portile2 (2.5.0) + mini_portile2 (2.5.1) minitest (5.14.4) momentjs-rails (2.20.1) railties (>= 3.1) @@ -320,7 +324,7 @@ GEM nenv (0.3.0) netrc (0.11.0) nio4r (2.5.7) - nokogiri (1.11.2) + nokogiri (1.11.3) mini_portile2 (~> 2.5.0) racc (~> 1.4) notiffany (0.1.1) @@ -332,7 +336,7 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - octokit (4.20.0) + octokit (4.21.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) omniauth (1.9.1) @@ -496,7 +500,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.4) + rexml (3.2.5) rolify (5.2.0) rqrcode (0.10.1) chunky_png (~> 1.0) @@ -637,7 +641,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.6.0) + unicode-display_width (1.6.1) unicode_utils (1.4.0) unobtrusive_flash (3.3.1) railties From 33552a5afa9a5af18fd1f2b5acd174476572b6a4 Mon Sep 17 00:00:00 2001 From: CactusPuppy Date: Sat, 1 May 2021 14:50:03 -0700 Subject: [PATCH 8/8] [fix] Fix typo in header --- app/views/conferences/_header.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index 817345d9..4ee7123c 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -5,7 +5,7 @@ - if current_user.ticket_purchases.by_conference(@conference).empty? .alert.bg-info{ :role => "alert", :style => "margin-bottom: 100px" } You have not purchased any tickets for this conference yet. - = link_to "Book you tickets now!", "#tickets" + = link_to "Book your tickets now!", "#tickets" .row .col-md-6.col-md-offset-3{ id: (conference.picture? ? "header-image" : "header-no-image") } .row