Adds website link to lodging
This commit is contained in:
parent
feabc3b954
commit
01bd45a045
7 changed files with 22 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
class Lodging < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :photo
|
||||
attr_accessible :name, :description, :photo, :website_link
|
||||
belongs_to :venue
|
||||
has_attached_file :photo,
|
||||
styles: { thumb: '100x100>', large: '300x300>' }
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
of what they are offering, about types of rooms, prices and address' %>
|
||||
<%= image_tag f.object.photo(:thumb) if !f.object.photo.blank? %>
|
||||
<%= f.input :photo %>
|
||||
<%= f.input :website_link %>
|
||||
<%= remove_association_link :lodging, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
5
db/migrate/20140614174354_add_website_link_to_lodging.rb
Normal file
5
db/migrate/20140614174354_add_website_link_to_lodging.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
class AddWebsiteLinkToLodging < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :lodgings, :website_link, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20140614171853) do
|
||||
ActiveRecord::Schema.define(version: 20140614174354) do
|
||||
|
||||
create_table "answers", force: true do |t|
|
||||
t.string "title"
|
||||
|
|
@ -203,6 +203,7 @@ ActiveRecord::Schema.define(version: 20140614171853) do
|
|||
t.integer "venue_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "website_link"
|
||||
end
|
||||
|
||||
create_table "people", force: true do |t|
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ FactoryGirl.define do
|
|||
factory :lodging do
|
||||
name 'Example Hotel'
|
||||
description 'Lorem Ipsum Dolor'
|
||||
website_link 'http://www.example.com'
|
||||
venue
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,18 +24,29 @@ feature Lodging do
|
|||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
set('Lorem Ipsum Dolor')
|
||||
|
||||
attach_file 'Photo', path
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
set('http://www.example.com')
|
||||
|
||||
click_button 'Update Venue'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Lodgings were successfully updated.')
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
value).to eq('Example Hotel')
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
value).to eq('Lorem Ipsum Dolor')
|
||||
|
||||
expect(page).to have_selector("img[src*='rails.png']")
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
value).to eq('http://www.example.com')
|
||||
|
||||
# Remove room
|
||||
click_link 'Remove lodging'
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ describe 'admin/lodgings/index' do
|
|||
render
|
||||
expect(rendered).to include('Example Hotel')
|
||||
expect(rendered).to include('Lorem Ipsum Dolor')
|
||||
expect(rendered).to include('http://www.example.com')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue