Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new design plus spec tests for Store, Product and Page class
- Loading branch information
Showing
13 changed files
with
236 additions
and
228 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
require 'rubygems' | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks :name => 'bigcartel' | ||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
desc "Default: run unit tests" | ||
task :default => :spec | ||
task :test => :spec | ||
|
||
desc "Run all specs" | ||
RSpec::Core::RakeTask.new do |t| | ||
t.pattern = 'spec/**/*_spec.rb' | ||
end | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module BigCartel | ||
class Base | ||
include HTTParty | ||
|
||
base_uri "http://api.bigcartel.com" | ||
headers 'Content-Type' => 'application/json' | ||
|
||
attr_reader :subdomain | ||
|
||
def initialize(subdomain) | ||
@subdomain = subdomain | ||
end | ||
|
||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'helper' | ||
|
||
describe BigCartel::Store do | ||
|
||
before do | ||
stub_request(:get, "api.bigcartel.com/park/page/about.js"). | ||
to_return(:body=>fixture("page.json"), :headers => {:content_type => "application/json; charset=utf-8"}) | ||
end | ||
|
||
it "BigCartel::Page.find return a page" do | ||
BigCartel::Page.find("park", "about") | ||
a_request(:get, "api.bigcartel.com/park/page/about.js"). | ||
should have_been_made | ||
end | ||
|
||
describe 'should build hash' do | ||
before(:each) { @store = BigCartel::Page.find("park", "about")} | ||
|
||
it "should have a permalink" do | ||
@store.permalink.should be_a String | ||
@store.permalink.should eq("about") | ||
end | ||
|
||
it { @store.content.should be_a String } | ||
it { @store.category.should be_a String } | ||
it { @store.name.should be_a String } | ||
it { @store.url.should be_a String } | ||
it { @store.id.should be_an Integer } | ||
end | ||
|
||
|
||
end |
Oops, something went wrong.