Skip to content

Commit

Permalink
Rewrite app for new structure. All tests pass, but we've exposed a co…
Browse files Browse the repository at this point in the history
…uple of bugs. [#44]
  • Loading branch information
marnen committed Oct 23, 2009
1 parent 48062a3 commit 135039d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/views/events/new.html.haml
Expand Up @@ -38,7 +38,7 @@
%tr
%th&= _("State")
%td
= f.collection_select :state_id, State.find(:all), :id, :name
= f.collection_select :state_id, Acts::Addressed::State.find(:all), :id, :name
= _(error_message_on :event, :state)
%tr
%th&= _("Zip")
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/new.html.haml
Expand Up @@ -40,7 +40,7 @@
%td= f.text_field :city
%tr
%th&= _("State")
%td= f.collection_select(:state_id, State.find(:all, :order => :name), :id, :name, :include_blank => true)
%td= f.collection_select(:state_id, Acts::Addressed::State.find(:all, :order => :name), :id, :name, :include_blank => true)
%tr
%th&= _("ZIP code")
%td= f.text_field :zip
Expand Down
4 changes: 2 additions & 2 deletions spec/blueprints.rb
Expand Up @@ -17,13 +17,13 @@
created_by {User.make}
end

State.blueprint do
Acts::Addressed::State.blueprint do
country
name {Sham.generic_name}
code
end

Country.blueprint do
Acts::Addressed::Country.blueprint do
name {Sham.generic_name}
code
end
Expand Down
6 changes: 3 additions & 3 deletions spec/models/event_spec.rb
Expand Up @@ -42,7 +42,7 @@

it "should have a country property referred through state" do
event = Event.new
event.state = State.new
event.state = Acts::Addressed::State.new
event.country.should == event.state.country
end

Expand All @@ -55,10 +55,10 @@
aggr = Event.reflect_on_aggregation(:address)
aggr.should_not be_nil
aggr.options[:mapping].should == [%w(street street), %w(street2 street2), %w(city city), %w(state_id state), %w(zip zip), %w(coords coords)]
state = State.make(:code => 'NY', :country => Country.make(:code => 'US'))
state = Acts::Addressed::State.make
opts = {:street => '123 Main Street', :street2 => '1st floor', :city => 'Anytown', :zip => 12345, :state => state}
e = Event.new(opts)
e.address.should == Address.new(opts)
e.address.should == Acts::Addressed::Address.new(opts)
end

it "should have a deleted property" do
Expand Down
6 changes: 3 additions & 3 deletions spec/models/user_spec.rb
Expand Up @@ -38,10 +38,10 @@
aggr = User.reflect_on_aggregation(:address)
aggr.should_not be_nil
aggr.options[:mapping].should == [%w(street street), %w(street2 street2), %w(city city), %w(state_id state), %w(zip zip), %w(coords coords)]
state = State.make(:code => 'NY', :country => Country.make(:code => 'US'))
state = Acts::Addressed::State.make
opts = {:street => '123 Main Street', :street2 => '1st floor', :city => 'Anytown', :zip => 12345, :state => state}
u = User.new(opts)
u.address.should == Address.new(opts)
u.address.should == Acts::Addressed::Address.new(opts)
end

it "should have a writable flag controlling display of personal information on contact list" do
Expand All @@ -51,7 +51,7 @@
end

it "should have country referred through state" do
state = State.make
state = Acts::Addressed::State.make
user = User.new
user.should respond_to(:country)
user.state = state
Expand Down
2 changes: 1 addition & 1 deletion spec/views/calendars/users.html.haml_spec.rb
Expand Up @@ -21,7 +21,7 @@
@all_users.each do |u|
p = u.permissions[0]
u.permissions.stub!(:find_by_calendar_id).and_return(p)
u.stub!(:state).and_return(mock_model(State, :null_object => true))
u.stub!(:state).and_return Acts::Addressed::State.make
u.stub!(:street).and_return('123 Main Street')
u.stub!(:street2).and_return('x')
u.stub!(:city).and_return('Somewhere')
Expand Down
2 changes: 1 addition & 1 deletion spec/views/events/map.html.haml_spec.rb
Expand Up @@ -6,7 +6,7 @@
end

it "should render the map in @map" do
address = Address.new
address = Acts::Addressed::Address.new
address.should_receive(:to_s).with(:geo).and_return('Arbitrary Address, Somewhere, NY, US')
User.stub!(:current_user).and_return(mock_model(User, :address => address))
render 'events/map'
Expand Down

0 comments on commit 135039d

Please sign in to comment.