This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'abebooks4r' | |
| Abebooks4r::Abe.configure do |options| | |
| options[:clientkey] = ABE_ACCESS_KEY | |
| end | |
| Abebooks4r::Abe.debug = true | |
| res = Abebooks4r::Abe.search(:author => 'Brad Ediger', :title => 'Advanced Rails') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add more helper methods to be used by all tests here... | |
| def load_xml_fixture_file(name) | |
| path = RAILS_ROOT + "/test/fixtures/#{name}.xml" | |
| if File.exists?(path) | |
| contents = "" | |
| File.open(path).each do |line| | |
| contents << line | |
| end | |
| return contents | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| require 'fakeweb' | |
| require 'shoulda' | |
| class UserTest < ActiveSupport::TestCase | |
| def setup | |
| FakeWeb.allow_net_connect = false | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| context "logged in user" do | |
| setup do | |
| @user_resp = load_xml_fixture_file('user') | |
| FakeWeb.register_uri(:get, "http://api.sample.com/users/123.xml", :body => @user_resp, :status => ["200", "OK"]) | |
| end | |
| should "be able to retrieve user object with given id" do | |
| user = User.find(123) | |
| assert_equal 123, user.id | |
| assert_equal "test@example.com", user.email |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Specify gems that this application depends on in test env and have them installed with rake gems:install RAILS_ENV="test" | |
| config.gem "fakeweb" | |
| config.gem "shoulda" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install build-essential |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install ruby ri rdoc irb ruby-dev libruby libreadline-ruby libopenssl-ruby mysql-client mysql-server libmysql-ruby libmysqlclient-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd ~ | |
| mkdir gems | |
| cd gems | |
| wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.1.tgz | |
| tar -xf rubygems-1.5.1.tgz | |
| cd rubygems-1.5.1 | |
| sudo ruby setup.rb | |
| sudo ln -s /usr/bin/gem1.8 /usr/bin/gem |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install sqlite3 libsqlite3-dev | |
| sudo gem install sqlite3-ruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo gem install rails |
OlderNewer