Skip to content
Browse files

Profile.rb - changed header for parsing name

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...
1 parent 1eebe41 commit e75012b3468d5322cc2221acac65386eab37d83b Sergei Shevlyagin committed Mar 28, 2013
View
2 lib/kickstarter/profile.rb
@@ -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
View
4 lib/kickstarter/project.rb
@@ -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.
@@ -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)
View
2 lib/kickstarter/project_card.rb
@@ -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
View
2 spec/profile_spec.rb
@@ -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
View
2 spec/project_card_spec.rb
@@ -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
View
2 spec/spec_helper.rb
@@ -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

0 comments on commit e75012b

Please sign in to comment.
Something went wrong with that request. Please try again.