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
| 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
| 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
| # 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 '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') |
NewerOlder