Sha256: db85b7f0615497a550d385c1dd49de6d3ecb26ddccecedff7483de2130f7ee55
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require 'spec_helper' describe Formic::Button do before(:each) do @model = Object.new stub(@page = Object.new).url_for(@model) {'/models/1'} stub(@page).render @options = {} @block = Proc.new {} end context "#initialize" do before(:each) do @button = Formic::Button.new @page, 'name', @options, &@block end it "should have template formic/default/button" do @button.template.should == 'formic/default/button' end it "should have class button" do @button.should have_class 'button' end it "should set field value" do @button.label.should == 'name' end end context "#method_missing" do before(:each) do @button = Formic::Button.new @page @result = @button.go_ahead @options, &@block end it "should have class as action" do @button.options[:class].last.should == 'go_ahead' end it "should generate label as class" do @button.label.should == 'Go Ahead' end it "should return the object" do @result.should == @button end it "should use label if label is given" do button = Formic::Button.new @page result = @button.go_ahead 'Button Label', @options, &@block result.label.should == 'Button Label' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
formic-0.2.5 | spec/formic/button_spec.rb |
formic-0.2.1 | spec/formic/button_spec.rb |
formic-0.1.0 | spec/formic/button_spec.rb |