Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host can make offer on listing #15

Open
wants to merge 21 commits into
base: development
Choose a base branch
from

Conversation

stefankarlberg
Copy link
Contributor

PT Story

Changes proposed in this pull request:

  • Feature tests for happy and sad paths for the scenario
  • Creates a Offer model, columns in db: name, email, location, price with foreign key - listing_id.
  • Creates Offer controller with 'index', 'new' and 'create' methods
  • Defines Offer in the routes as a nested route in listings
  • Creates listing show view, adds form for offer

What we have learned working on this feature:

  • Learned more about debugging with binding.pry
  • Refreshes HAML syntax
  • Nesting routes

Screenshots

Screenshot 2019-05-10 at 15 05 02

Carrosen and others added 17 commits May 9, 2019 12:14
…e of columns in Offer model, adds show method to offers controller
…curate ones, removes empty lines. First test in scenario going green, 1/10
…essage saying you need to fill in all fields correctly
features/host_can_make_offer_on_listing.feature Outdated Show resolved Hide resolved
features/host_can_make_offer_on_listing.feature Outdated Show resolved Hide resolved
features/step_definitions/assertion_steps.rb Outdated Show resolved Hide resolved
spec/models/offer_spec.rb Show resolved Hide resolved
app/models/offer.rb Show resolved Hide resolved
end

def new
@offer = Offer.new(offer_params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to use an instance variable here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

end

def create
@listing = Listing.find(params[:listing_id])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to use an instance variable here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt work without

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you try?


def create
@listing = Listing.find(params[:listing_id])
@offer = @listing.offers.create(offer_params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to use an instance variable here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didnt work without

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain what is the other option you tried @Carrosen

features/step_definitions/basic_steps.rb Outdated Show resolved Hide resolved
When I visit the landing page

Scenario: Host can successfully create an offer
Then I should see "Zane"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary to test for this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Then I should see "Zane"
When I click "Make an offer" within "Zane" section
Then I should be on the "Zane" listing page
Then I should see "Create your offer"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

When I click "Make an offer" within "Zane" section
Then I should be on the "Zane" listing page
Then I should see "Create your offer"
And I fill in "Name" with "Steffe"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Then I should be on landing page

Scenario: Host can not create an offer when not all the fields are filled in.
When I click "Make an offer" within "Zane" section
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants