Skip to content

Commit

Permalink
Some more basic specs for activator and inner_class options
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Campos committed Oct 22, 2011
1 parent 33c5256 commit ac36ec5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/helpers/best_in_place_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
@span.attribute("data-object").value.should == "user"
end

it "should have no activator by default" do
@span.attribute("data-activator").should be_nil
end

it "should have no inner_class by default" do
@span.attribute("data-inner-class").should be_nil
end

describe "url generation" do
it "should have the correct default url" do
@user.save!
Expand Down Expand Up @@ -73,6 +81,10 @@
end

describe "nil option" do
it "should have no nil data by default" do
@span.attribute("data-nil").should be_nil
end

it "should show '' if the object responds with nil for the passed attribute" do
@user.stub!(:name).and_return(nil)
nk = Nokogiri::HTML.parse(helper.best_in_place @user, :name)
Expand All @@ -87,6 +99,20 @@
span.text.should == ""
end
end

it "should have the given inner_class" do
out = helper.best_in_place @user, :name, :inner_class => "awesome"
nk = Nokogiri::HTML.parse(out)
span = nk.css("span")
span.attribute("data-inner-class").value.should == "awesome"
end

it "should have the given activator" do
out = helper.best_in_place @user, :name, :activator => "awesome"
nk = Nokogiri::HTML.parse(out)
span = nk.css("span")
span.attribute("data-activator").value.should == "awesome"
end
end


Expand Down

0 comments on commit ac36ec5

Please sign in to comment.