bandsintown 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.dirname(__FILE__) + "/../Rakefile"
4
+ require 'rubyforge'
5
+ require 'redcloth'
6
+ require 'syntax/convertors/html'
7
+ require 'erb'
8
+
9
+ download = "http://rubyforge.org/projects/#{$hoe.rubyforge_name}"
10
+ version = $hoe.version
11
+
12
+ def rubyforge_project_id
13
+ RubyForge.new.configure.autoconfig["group_ids"][$hoe.rubyforge_name]
14
+ end
15
+
16
+ class Fixnum
17
+ def ordinal
18
+ # teens
19
+ return 'th' if (10..19).include?(self % 100)
20
+ # others
21
+ case self % 10
22
+ when 1: return 'st'
23
+ when 2: return 'nd'
24
+ when 3: return 'rd'
25
+ else return 'th'
26
+ end
27
+ end
28
+ end
29
+
30
+ class Time
31
+ def pretty
32
+ return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
33
+ end
34
+ end
35
+
36
+ def convert_syntax(syntax, source)
37
+ return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
38
+ end
39
+
40
+ if ARGV.length >= 1
41
+ src, template = ARGV
42
+ template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
43
+ else
44
+ puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
45
+ exit!
46
+ end
47
+
48
+ template = ERB.new(File.open(template).read)
49
+
50
+ title = nil
51
+ body = nil
52
+ File.open(src) do |fsrc|
53
+ title_text = fsrc.readline
54
+ body_text_template = fsrc.read
55
+ body_text = ERB.new(body_text_template).result(binding)
56
+ syntax_items = []
57
+ body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
58
+ ident = syntax_items.length
59
+ element, syntax, source = $1, $2, $3
60
+ syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
61
+ "syntax-temp-#{ident}"
62
+ }
63
+ title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
64
+ body = RedCloth.new(body_text).to_html
65
+ body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
66
+ end
67
+ stat = File.stat(src)
68
+ created = stat.ctime
69
+ modified = stat.mtime
70
+
71
+ $stdout << template.result(binding)
@@ -0,0 +1,114 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Bandsintown::Artist do
4
+
5
+ before(:each) do
6
+ @name = "Little Brother"
7
+ @url = "http://www.bandsintown.com/LittleBrother"
8
+ @artist = Bandsintown::Artist.new(@name, @url)
9
+ end
10
+
11
+ describe ".initialize(name, url = nil)" do
12
+ it "should set the Artist name" do
13
+ @artist.name.should == @name
14
+ end
15
+ it "should set the Artist bandsintown_url if given" do
16
+ @artist.bandsintown_url.should == @url
17
+ end
18
+
19
+ describe "generating a url (initialize with nil url)" do
20
+ it "should strip spaces" do
21
+ name = "The Beatles "
22
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/TheBeatles"
23
+ end
24
+ it "should convert '&' -> 'And'" do
25
+ name = "Meg & Dia"
26
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/MegAndDia"
27
+ end
28
+ it "should convert '+' -> 'Plus'" do
29
+ name = "+44"
30
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/Plus44"
31
+ end
32
+ it "should camelcase seperate words" do
33
+ name = "meg & dia"
34
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/MegAndDia"
35
+ end
36
+ it "should not cgi escape url" do
37
+ name = "$up"
38
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/$up"
39
+ end
40
+ it "should uri escape accented characters" do
41
+ name = "sigur rós"
42
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/SigurR%C3%B3s"
43
+ end
44
+ it "should not alter the case of single word names" do
45
+ name = "AWOL"
46
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/AWOL"
47
+ end
48
+ it "should allow dots" do
49
+ name = "M.I.A"
50
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/M.I.A"
51
+ end
52
+ it "should allow exclamations" do
53
+ name = "against me!"
54
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/AgainstMe!"
55
+ end
56
+ it "should not modify @name" do
57
+ name = "this is how i think"
58
+ Bandsintown::Artist.new(name)
59
+ name.should == "this is how i think"
60
+ end
61
+ it "should cgi escape '/' so it will be double encoded" do
62
+ name = "AC/DC"
63
+ escaped_name = URI.escape(name.gsub('/', CGI.escape('/')))
64
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/#{escaped_name}"
65
+ end
66
+ it "should cgi escape '?' so it will be double encoded" do
67
+ name = "Does it offend you, yeah?"
68
+ escaped_name = URI.escape("DoesItOffendYou,Yeah#{CGI.escape('?')}")
69
+ Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/#{escaped_name}"
70
+ end
71
+ end
72
+ end
73
+
74
+ describe ".resource_path" do
75
+ it "should return the API resource path for artists" do
76
+ Bandsintown::Artist.resource_path.should == 'artists'
77
+ end
78
+ end
79
+
80
+ describe "#events" do
81
+ before(:each) do
82
+ @artist = Bandsintown::Artist.new("Little Brother")
83
+ end
84
+ it "should request and parse a call to the BIT artist events API method and the artist's api name" do
85
+ @artist.should_receive(:api_name).and_return("Little+Brother")
86
+ Bandsintown::Artist.should_receive(:request_and_parse).with("Little+Brother/events").and_return([])
87
+ @artist.events
88
+ end
89
+ it "should return an Array of Bandsintown::Event objects built from the response" do
90
+ event_1 = mock(Bandsintown::Event)
91
+ event_2 = mock(Bandsintown::Event)
92
+ results = [ "event 1", "event 2" ]
93
+ Bandsintown::Artist.stub!(:request_and_parse).and_return(results)
94
+ Bandsintown::Event.should_receive(:build_from_json).with("event 1").ordered.and_return(event_1)
95
+ Bandsintown::Event.should_receive(:build_from_json).with("event 2").ordered.and_return(event_2)
96
+ @artist.events.should == [event_1, event_2]
97
+ end
98
+ it "should be cached" do
99
+ @artist.events = 'events'
100
+ Bandsintown::Artist.should_not_receive(:request_and_parse)
101
+ @artist.events.should == 'events'
102
+ end
103
+ end
104
+
105
+ describe "#api_name" do
106
+ it "should URI escape @name" do
107
+ @artist.api_name.should == URI.escape(@artist.name)
108
+ end
109
+ it "should CGI escape / and ? characters before URI escaping the whole name" do
110
+ Bandsintown::Artist.new("AC/DC").api_name.should == URI.escape(CGI.escape("AC/DC"))
111
+ Bandsintown::Artist.new("?uestlove").api_name.should == URI.escape(CGI.escape("?uestlove"))
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,70 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Bandsintown::Base do
4
+
5
+ describe ".connection" do
6
+ it "should be an instance of Bandsintown::Connection" do
7
+ Bandsintown::Base.connection.class.should == Bandsintown::Connection
8
+ end
9
+ it "should be cached" do
10
+ Bandsintown::Base.connection.should === Bandsintown::Base.connection
11
+ end
12
+ end
13
+
14
+ describe ".request(api_method, args={})" do
15
+ it "should make a request to the connection url" do
16
+ resource_path = "events"
17
+ method = "search"
18
+ args = { :arg => "value" }
19
+ Bandsintown::Base.stub!(:resource_path).and_return(resource_path)
20
+ Bandsintown::Base.connection.should_receive(:request).with(resource_path, method, args)
21
+ Bandsintown::Base.request(method, args)
22
+ end
23
+ end
24
+
25
+ describe ".parse(response)" do
26
+ it "should check the response for errors" do
27
+ response = "response"
28
+ parsed = mock("parsed json")
29
+ JSON.stub!(:parse).and_return(parsed)
30
+ Bandsintown::Base.should_receive(:check_for_errors).with(parsed)
31
+ Bandsintown::Base.parse(response)
32
+ end
33
+ it "should convert the response from JSON format and return it" do
34
+ response = "{\"ok\": 123}\n"
35
+ Bandsintown::Base.parse(response).should == { "ok" => 123 }
36
+ end
37
+ end
38
+
39
+ describe ".request_and_parse(api_method, args={})" do
40
+ before(:each) do
41
+ @resource_path = "events"
42
+ @method = "search"
43
+ @args = { :arg => "value" }
44
+ Bandsintown::Base.stub!(:resource_path).and_return(@resource_path)
45
+ @response = mock("WWW::Mechanize response")
46
+ end
47
+ it "should make a request" do
48
+ Bandsintown::Base.should_receive(:request).with(@method, @args).and_return(@response)
49
+ Bandsintown::Base.stub!(:parse)
50
+ Bandsintown::Base.request_and_parse(@method, @args)
51
+ end
52
+ it "should parse the response" do
53
+ Bandsintown::Base.stub!(:request).and_return(@response)
54
+ Bandsintown::Base.should_receive(:parse).with(@response)
55
+ Bandsintown::Base.request_and_parse(@method, @args)
56
+ end
57
+ end
58
+
59
+ describe ".check_for_errors(json)" do
60
+ it "should raise an APIError containing all the error messages from the API, if the response has error messages" do
61
+ json = { "errors" => [ "location or artists param is required", "invalid date format" ] }
62
+ lambda { Bandsintown::Base.check_for_errors(json) }.should raise_error(Bandsintown::APIError, "location or artists param is required, invalid date format")
63
+ end
64
+ it "should not raise an error if the response doesn't have error messages" do
65
+ json = { "something" => "thats not an error" }
66
+ lambda { Bandsintown::Base.check_for_errors(json) }.should_not raise_error
67
+ end
68
+ end
69
+
70
+ end
@@ -0,0 +1,85 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Bandsintown::Connection do
4
+ before(:each) do
5
+ Bandsintown.app_id = 'YOUR_APP_ID'
6
+ @base_url = "http://api.bandsintown.com"
7
+ end
8
+
9
+ describe ".initialize(base_url)" do
10
+ it "should set the base_url for the Connection" do
11
+ Bandsintown::Connection.new(@base_url).base_url.should == @base_url
12
+ end
13
+ end
14
+
15
+ describe ".request(url_path, args = {}, method = :get)" do
16
+ before(:each) do
17
+ @connection = Bandsintown::Connection.new(@base_url)
18
+ @response = StringIO.new("response")
19
+ @connection.stub!(:open).and_return(@response)
20
+ @api_resource = "events"
21
+ @api_method = "search"
22
+ end
23
+ it "should convert args to url parameters when making a request" do
24
+ args = { :artists => ["Little Brother", "Joe Scudda"], :location => "Boston, MA", :radius => 10 }
25
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&artists%5B%5D=Little+Brother&artists%5B%5D=Joe+Scudda&format=json&location=Boston%2C+MA&radius=10"
26
+ @connection.should_receive(:open).with(request_url).and_return(@response)
27
+ @connection.request(@api_resource, @api_method, args)
28
+ end
29
+ it "should convert args[:start_date] and args[:end_date] to a single args[:date] parameter when making a request" do
30
+ args = { :start_date => "2009-01-01", :end_date => "2009-02-01" }
31
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=2009-01-01%2C2009-02-01&format=json"
32
+ @connection.should_receive(:open).with(request_url).and_return(@response)
33
+ @connection.request(@api_resource, @api_method, args)
34
+ end
35
+ it "should allow date to be a Time object" do
36
+ args = { :date => Time.now.beginning_of_day }
37
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=#{Time.now.beginning_of_day.strftime("%Y-%m-%d")}&format=json"
38
+ @connection.should_receive(:open).with(request_url).and_return(@response)
39
+ @connection.request(@api_resource, @api_method, args)
40
+ end
41
+ it "should allow date to be a Date object" do
42
+ args = { :date => Date.today }
43
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=#{Date.today.strftime("%Y-%m-%d")}&format=json"
44
+ @connection.should_receive(:open).with(request_url).and_return(@response)
45
+ @connection.request(@api_resource, @api_method, args)
46
+ end
47
+ it "should allow date to be a String object" do
48
+ args = { :date => "2009-01-01" }
49
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=2009-01-01&format=json"
50
+ @connection.should_receive(:open).with(request_url).and_return(@response)
51
+ @connection.request(@api_resource, @api_method, args)
52
+ end
53
+ it "should allow start date and end date to be Time objects" do
54
+ args = { :start_date => 1.week.ago, :end_date => 1.week.from_now }
55
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=#{1.week.ago.strftime('%Y-%m-%d')}%2C#{1.week.from_now.strftime('%Y-%m-%d')}&format=json"
56
+ @connection.should_receive(:open).with(request_url).and_return(@response)
57
+ @connection.request(@api_resource, @api_method, args)
58
+ end
59
+ it "should allow start date and end date to be Date objects" do
60
+ args = { :start_date => 1.week.ago.to_date, :end_date => 1.week.from_now.to_date }
61
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=#{1.week.ago.to_date.strftime('%Y-%m-%d')}%2C#{1.week.from_now.to_date.strftime('%Y-%m-%d')}&format=json"
62
+ @connection.should_receive(:open).with(request_url).and_return(@response)
63
+ @connection.request(@api_resource, @api_method, args)
64
+ end
65
+ it "should allow start date and end date to be String objects" do
66
+ args = { :start_date => "2009-01-01", :end_date => "2009-02-01" }
67
+ request_url = "http://api.bandsintown.com/events/search?app_id=YOUR_APP_ID&date=2009-01-01%2C2009-02-01&format=json"
68
+ @connection.should_receive(:open).with(request_url).and_return(@response)
69
+ @connection.request(@api_resource, @api_method, args)
70
+ end
71
+ it "should return the API error message instead of raising an error if there was a problem with the request (404 response)" do
72
+ error = OpenURI::HTTPError.new('404', StringIO.new('error message'))
73
+ @connection.stub!(:open).and_raise(error)
74
+ lambda { @connection.request("", "", {}) }.should_not raise_error
75
+ error.io.rewind
76
+ @connection.request("", "", {}).should == 'error message'
77
+ end
78
+ it "should set the format to json and the send app id without the user having to specify them" do
79
+ request_url = "http://api.bandsintown.com/events/search?app_id=#{Bandsintown.app_id}&format=json"
80
+ @connection.should_receive(:open).with(request_url).and_return(@response)
81
+ @connection.request(@api_resource, @api_method, {})
82
+ end
83
+ end
84
+
85
+ end
@@ -0,0 +1,149 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe Bandsintown::Event do
4
+
5
+ describe ".resource_path" do
6
+ it "should return the relative path to Event requests" do
7
+ Bandsintown::Event.resource_path.should == "events"
8
+ end
9
+ end
10
+
11
+ describe ".search(args = {})" do
12
+ @args = { :location => "Boston, MA", :date => "2009-01-01" }
13
+ it "should request and parse a call to the BIT events search api method" do
14
+ Bandsintown::Event.should_receive(:request_and_parse).with("search", @args).and_return([])
15
+ Bandsintown::Event.search(@args)
16
+ end
17
+ it "should return an Array of Bandsintown::Event objects built from the response" do
18
+ event_1 = mock(Bandsintown::Event)
19
+ event_2 = mock(Bandsintown::Event)
20
+ results = [ "event 1", "event 2" ]
21
+ Bandsintown::Event.stub!(:request_and_parse).and_return(results)
22
+ Bandsintown::Event.should_receive(:build_from_json).with("event 1").ordered.and_return(event_1)
23
+ Bandsintown::Event.should_receive(:build_from_json).with("event 2").ordered.and_return(event_2)
24
+ Bandsintown::Event.search(@args).should == [event_1, event_2]
25
+ end
26
+ end
27
+
28
+ describe ".recommended(args = {})" do
29
+ @args = { :location => "Boston, MA", :date => "2009-01-01" }
30
+ it "should request and parse a call to the BIT recommended events api method" do
31
+ Bandsintown::Event.should_receive(:request_and_parse).with("recommended", @args).and_return([])
32
+ Bandsintown::Event.recommended(@args)
33
+ end
34
+ it "should return an Array of Bandsintown::Event objects built from the response" do
35
+ event_1 = mock(Bandsintown::Event)
36
+ event_2 = mock(Bandsintown::Event)
37
+ results = [ "event 1", "event 2" ]
38
+ Bandsintown::Event.stub!(:request_and_parse).and_return(results)
39
+ Bandsintown::Event.should_receive(:build_from_json).with("event 1").ordered.and_return(event_1)
40
+ Bandsintown::Event.should_receive(:build_from_json).with("event 2").ordered.and_return(event_2)
41
+ Bandsintown::Event.recommended(@args).should == [event_1, event_2]
42
+ end
43
+ end
44
+
45
+ describe ".daily" do
46
+ it "should request and parse a call to the BIT daily events api method" do
47
+ Bandsintown::Event.should_receive(:request_and_parse).with("daily").and_return([])
48
+ Bandsintown::Event.daily
49
+ end
50
+ it "should return an array of Bandsintown::Events built from the response" do
51
+ event = mock(Bandsintown::Event)
52
+ Bandsintown::Event.stub!(:request_and_parse).and_return(['event json'])
53
+ Bandsintown::Event.should_receive(:build_from_json).with('event json').and_return(event)
54
+ Bandsintown::Event.daily.should == [event]
55
+ end
56
+ end
57
+
58
+ describe ".build_from_json(json_hash)" do
59
+ before(:each) do
60
+ @event_id = 745089
61
+ @event_url = "http://www.bandsintown.com/event/745095"
62
+ @datetime = "2008-09-30T19:30:00"
63
+ @ticket_url = "http://www.bandsintown.com/event/745095/buy_tickets"
64
+
65
+ @artist_1 = { "name" => "Little Brother", "url" => "http://www.bandsintown.com/LittleBrother" }
66
+ @artist_2 = { "name" => "Joe Scudda", "url" => "http://www.bandsintown.com/JoeScudda" }
67
+
68
+ @venue_hash = {
69
+ "id" => 327987,
70
+ "url" => "http://www.bandsintown.com/venue/327987",
71
+ "region" => "MA",
72
+ "city" => "Boston",
73
+ "name" => "Paradise Rock Club",
74
+ "country" => "United States",
75
+ "latitude" => 42.37,
76
+ "longitude" => 71.03
77
+ }
78
+
79
+ @event_hash = {
80
+ "id" => @event_id,
81
+ "url" => @event_url,
82
+ "datetime" => @datetime,
83
+ "ticket_url" => @ticket_url,
84
+ "artists" => [@artist_1, @artist_2],
85
+ "venue" => @venue_hash,
86
+ "status" => "new",
87
+ "ticket_status" => "available",
88
+ "on_sale_datetime" => "2008-09-01T19:30:00"
89
+ }
90
+
91
+ @built_event = Bandsintown::Event.build_from_json(@event_hash)
92
+ end
93
+ it "should return a built Event" do
94
+ @built_event.class.should == Bandsintown::Event
95
+ end
96
+ it "should set the Event id" do
97
+ @built_event.bandsintown_id.should == @event_id
98
+ end
99
+ it "should set the Event url" do
100
+ @built_event.bandsintown_url.should == @event_url
101
+ end
102
+ it "should set the Event datetime" do
103
+ @built_event.datetime.should == Time.parse(@datetime)
104
+ end
105
+ it "should set the Event ticket url" do
106
+ @built_event.ticket_url.should == @ticket_url
107
+ end
108
+ it "should set the Event status" do
109
+ @built_event.status.should == "new"
110
+ end
111
+ it "should set the Event ticket_status" do
112
+ @built_event.ticket_status.should == "available"
113
+ end
114
+ it "should set the Event on_sale_datetime" do
115
+ @built_event.on_sale_datetime.should == Time.parse(@event_hash['on_sale_datetime'])
116
+ end
117
+ it "should set the Event on_sale_datetime to nil if not given" do
118
+ @event_hash['on_sale_datetime'] = nil
119
+ Bandsintown::Event.build_from_json(@event_hash).on_sale_datetime.should be_nil
120
+ end
121
+ it "should set the Event's Venue" do
122
+ built_venue = mock(Bandsintown::Venue)
123
+ Bandsintown::Venue.should_receive(:new).with(@venue_hash).and_return(built_venue)
124
+ @built_event = Bandsintown::Event.build_from_json(@event_hash)
125
+ @built_event.venue.should == built_venue
126
+ end
127
+ it "should set the Event's Artists" do
128
+ built_artist_1 = mock(Bandsintown::Artist, :name => "Little Brother")
129
+ built_artist_2 = mock(Bandsintown::Artist, :name => "Joe Scudda")
130
+ Bandsintown::Artist.should_receive(:new).with(@artist_1["name"], @artist_1["url"]).and_return(built_artist_1)
131
+ Bandsintown::Artist.should_receive(:new).with(@artist_2["name"], @artist_2["url"]).and_return(built_artist_2)
132
+ @built_event = Bandsintown::Event.build_from_json(@event_hash)
133
+ @built_event.artists.should == [built_artist_1, built_artist_2]
134
+ end
135
+ end
136
+
137
+ describe "#tickets_available?" do
138
+ it "should return true if @ticket_status is 'available'" do
139
+ event = Bandsintown::Event.new
140
+ event.ticket_status = 'available'
141
+ event.tickets_available?.should be_true
142
+ end
143
+ it "should return false if @ticket_status is not 'available'" do
144
+ event = Bandsintown::Event.new
145
+ event.ticket_status = 'unavailable'
146
+ event.tickets_available?.should be_false
147
+ end
148
+ end
149
+ end