Skip to content

Commit

Permalink
Profile.rb - changed header for parsing name
Browse files Browse the repository at this point in the history
Project.rb - changed header for parsing name, added BASE_URL for returning url
Project_card.rb - added BASE_URL for updating URL

Updated specs for tests
  • Loading branch information
Sergei Shevlyagin committed Mar 28, 2013
1 parent 1eebe41 commit e75012b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/kickstarter/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(username)
end

def name
@name ||= page_content.css('#profile_bio h1').children.first.to_s.gsub(/\n/,'')
@name ||= page_content.css('#profile_bio h2').children.first.to_s.gsub(/\n/,'')
end

def username
Expand Down
4 changes: 2 additions & 2 deletions lib/kickstarter/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def description
end

def url
@url ||= details_page.css("h2#title a").attr('href').value
@url ||= BASE_URL + details_page.css("h2#title a").attr('href').value
end

# Note: Not all projects are assigned short_urls.
Expand All @@ -34,7 +34,7 @@ def handle
end

def owner
@owner ||= details_page.css('#creator-name h3 a').inner_html.to_s
@owner ||= details_page.css('#creator-name h5 a').inner_html.to_s
end

def image_url(style=:main)
Expand Down
2 changes: 1 addition & 1 deletion lib/kickstarter/project_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def description
end

def url
@url ||= node.css('h2 a').first.attribute('href').to_s.split('?').first
@url ||= BASE_URL + node.css('h2 a').first.attribute('href').to_s.split('?').first
end

def handle
Expand Down
2 changes: 1 addition & 1 deletion spec/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
it "finds the backed_count" do
VCR.use_cassette "profile/#{adamb}" do
@profile = Kickstarter::Profile.new(adamb)
@profile.backed_count.should eq(10)
@profile.backed_count.should eq(11)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/project_card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_node(project)

it "finds the project description" do
@project = Kickstarter::ProjectCard.new(get_node(diesel))
@project.description.should eq("Help me collect twelve years of webcomics into a complete ebook form while still keeping the files free to all.")
@project.description.should eq("\nHelp me collect twelve years of webcomics into a complete ebook form while still keeping the files free to all.\n")
end

it "finds the canonical project url" do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'money'

VCR.configure do |c|
c.default_cassette_options = { :record => :all }
c.default_cassette_options = { :record => :new_episodes }
c.cassette_library_dir = 'spec/vcr'
c.hook_into :webmock
end
Expand Down

0 comments on commit e75012b

Please sign in to comment.