Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Merge f6525ae into db75cb0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Harris committed Apr 14, 2016
2 parents db75cb0 + f6525ae commit 327625b
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/models/update_user.rb
Expand Up @@ -37,6 +37,6 @@ def update_sam
end

def user_params
params.require(:user).permit(:name, :duns_number, :email)
params.require(:user).permit(:name, :duns_number, :email, :credit_card_form_url)
end
end
3 changes: 3 additions & 0 deletions app/views/users/edit.html.erb
Expand Up @@ -25,5 +25,8 @@
<%= f.label :email, 'Email Address' %>
<%= f.text_field :email %>
<%= f.label :credit_card_form_url, 'Credit Card Form URL' %>
<%= f.text_field :credit_card_form_url %>
<%= f.submit 'Submit', :class => 'usa-button usa-button-outline' %>
<% end %>
2 changes: 1 addition & 1 deletion features/bid_details.feature
Expand Up @@ -15,7 +15,7 @@ Feature: Bid Details

Scenario: When the auction is open and I'm logged in
Given there is an open auction
And I am allowed to bid
And I am an authenticated vendor
And I have placed a bid
When I visit the auction bids page
Then I should see my name and DUNS only on my bids
6 changes: 3 additions & 3 deletions features/bidding.feature
Expand Up @@ -23,7 +23,7 @@ Feature: Bidding
Then I should see an "Authorize with GitHub" button

When I click on the "Authorize with GitHub" link
Then I should be on the profile edit page
Then I should be on my profile page
And I click on the "Submit" button
Then I should see the auction's title

Expand Down Expand Up @@ -61,7 +61,7 @@ Feature: Bidding

Scenario: Viewing an auction when I have not bid
Given there is an open bidless auction
And I am allowed to bid
And I am an authenticated vendor
When I visit the home page
And I click on the Bid button

Expand All @@ -71,7 +71,7 @@ Feature: Bidding

Scenario: When someone else has outbid me
Given there is an open auction
And I am allowed to bid
And I am an authenticated vendor
When I visit the home page
And I click on the "Bid" button

Expand Down
8 changes: 4 additions & 4 deletions features/closed_auctions.feature
Expand Up @@ -5,7 +5,7 @@ Feature: Closed Auctions

Scenario: I am the winner
Given there is a closed auction
And I am allowed to bid
And I am an authenticated vendor
And I have placed the lowest bid
When I visit the auction page
Then I should see the auction had a winning bid with name
Expand All @@ -15,7 +15,7 @@ Feature: Closed Auctions

Scenario: I am not the winner
Given there is a closed auction
And I am allowed to bid
And I am an authenticated vendor
And I have placed a bid that is not the lowest
When I visit the auction page
Then I should see the auction had a winning bid with name
Expand All @@ -25,7 +25,7 @@ Feature: Closed Auctions

Scenario: I have not bid on the auction
Given there is a closed auction
And I am allowed to bid
And I am an authenticated vendor
And I have not placed a bid
When I visit the auction page
Then I should see the auction had a winning bid with name
Expand All @@ -35,7 +35,7 @@ Feature: Closed Auctions

Scenario: Nobody has bid on the auction
Given there is a closed bidless auction
And I am allowed to bid
And I am an authenticated vendor
When I visit the auction page
Then I should see when the auction ended
And I should see the auction ended with no bids
Expand Down
32 changes: 32 additions & 0 deletions features/credit_card_url.feature
@@ -0,0 +1,32 @@
Feature: Credit Card Form URL
As a vendor on the platform
I want to see the Credit Card Form URL stored for my account
So that I can make sure payments are going to the right place

Scenario: Vendor views Credit Card Form URL
Given I am an authenticated vendor
And there is a Credit Card Form URL associated with my account
When I visit my profile page
Then I should see my credit card form URL in the "Credit Card Form URL" field

Scenario: Vendor saves a payment URL
Given I am an authenticated vendor
And there is no Credit Card Form URL associated with my account
When I visit my profile page
And I fill in the Credit Card Form URL field on my profile page
And I click on the "Submit" button
Then I should be on the home page

When I visit my profile page
Then I should see my credit card form URL in the "Credit Card Form URL" field

Scenario: Vendor edits an existing Payment URL
Given I am an authenticated vendor
And there is a Credit Card Form URL associated with my account
And I visit my profile page
When I fill in the Credit Card Form URL field on my profile page
And I click on the "Submit" button
Then I should be on the home page

When I visit my profile page
Then the new value should be stored as my Credit Card Form URL
8 changes: 4 additions & 4 deletions features/logging_in_and_out.feature
Expand Up @@ -61,7 +61,7 @@ Feature: logging in and out
Then I should see an "Authorize with GitHub" button

When I click on the "Authorize with GitHub" button
Then I should be on the profile edit page
Then I should be on my profile page
And I should see a profile form with my info
And there should be meta tags for the edit profile form

Expand All @@ -79,7 +79,7 @@ Feature: logging in and out
Then I should see an "Authorize with GitHub" button

When I click on the "Authorize with GitHub" button
Then I should be on the profile edit page
Then I should be on my profile page
And I should see "doris@doogooder.com" in the "Email Address" field
And I should see "Doris Doogooder" in the "Name" field

Expand All @@ -90,9 +90,9 @@ Feature: logging in and out
Then I should see an "Authorize with GitHub" button

When I click on the "Authorize with GitHub" button
Then I should be on the profile edit page
Then I should be on my profile page
And I should see a profile form with my info
And there should be meta tags for the edit profile form


When I fill the "Email Address" field with "doris_the_nonvalid_email_address_person"
And I click on the "Submit" button
Expand Down
6 changes: 3 additions & 3 deletions features/single_bid.feature
Expand Up @@ -13,7 +13,7 @@ Feature: Single-bid auctions

Scenario: bidding on a single-bid auction
Given there is a single-bid auction
And I am allowed to bid
And I am an authenticated vendor
When I visit the home page
Then I should not see "Current bid:"

Expand Down Expand Up @@ -42,7 +42,7 @@ Feature: Single-bid auctions

Scenario: viewing your own single bid
Given there is a single-bid auction
And I am allowed to bid
And I am an authenticated vendor
When I visit the auction page
And I click on the "BID" button
Then I should be on the new bid page
Expand All @@ -61,7 +61,7 @@ Feature: Single-bid auctions

Scenario: viewing the bid history for a closed single-bid auction
Given there is a closed single-bid auction
And I am allowed to bid
And I am an authenticated vendor
When I visit the auction bids page
Then I should not see "Bids are sealed until the auction ends."
And I should not see "See the auction rules to learn more."
Expand Down
50 changes: 50 additions & 0 deletions features/step_definitions/login_steps.rb
Expand Up @@ -55,12 +55,62 @@
fill_in(field, with: value)
end

When(/^there is no (.+) associated with my account$/) do |attribute|
attribute = attribute.parameterize('_')
@user.update_attribute(attribute, nil)
end

def fake_value_for_attribute(attribute)
case attribute
when 'credit_card_form_url'
Faker::Internet.url
when 'name'
Faker::Name.name
when 'duns_number'
Faker::Company.duns_number
when 'email'
Faker::Internet.email
else
fail "Unknown attribute '#{attribute}'"
end
end

When(/^there is a (.+) associated with my account$/) do |attr|
attribute = attr.parameterize('_')
@user.update_attribute(attribute, fake_value_for_attribute(attribute))
end

When(/^I fill in the (.+) field on my profile page$/) do |attribute|
attribute = attribute.parameterize('_')
value = fake_value_for_attribute(attribute)

@new_values ||= {}
@new_values[attribute] = value

step("I fill in the \"user_#{attribute}\" field with \"#{value}\"")
end

When(/^I fill in the "(.+)" field with "([^"]*)"$/) do |field, value|
fill_in(field, with: value)
end

Then(/^the new value should be stored as my (.+)$/) do |attribute|
attribute = attribute.parameterize('_')
field = find_field("user_#{attribute}")

expect(@new_values).to_not be_nil
expect(@new_values[attribute]).to_not be_nil
expect(field.value).to eq(@new_values[attribute])
end

Then(/^I should see "([^"]*)" in the "([^"]*)" field$/) do |value, field|
field = find_field(field)
expect(field.value).to eq(value)
end

Then(/^I should see my (.+) in the "([^"]*)" field$/) do |attribute, field|
@user.reload
attribute = attribute.parameterize('_')
field = find_field(field)
expect(field.value).to eq(@user.send(attribute))
end
Expand Down
6 changes: 5 additions & 1 deletion features/step_definitions/page_steps.rb
Expand Up @@ -39,6 +39,10 @@
visit my_bids_path
end

When(/^I visit my profile page$/) do
visit edit_user_path(@user)
end

Then(/^I should be on the home page$/) do
expect(page.current_path).to eq("/")
end
Expand All @@ -47,7 +51,7 @@
expect(page.current_path).to eq(auction_path(@auction))
end

Then(/^I should be on the profile edit page$/) do
Then(/^I should be on my profile page$/) do
expect(page.current_path).to eq(edit_user_path(@user))
end

Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/setup_steps.rb
Expand Up @@ -31,7 +31,7 @@
step("I sign in")
end

Given(/^I am allowed to bid$/) do
Given(/^I am an authenticated vendor$/) do
step("I am a user with a verified SAM account")
step("I sign in")
end
Expand Down

0 comments on commit 327625b

Please sign in to comment.