spec/dashboard_spec.rb in split-0.6.6 vs spec/dashboard_spec.rb in split-0.7.0

- old
+ new

@@ -12,29 +12,52 @@ def link(color) Split::Alternative.new(color, experiment.name) end let(:experiment) { - Split::Experiment.find_or_create('link_color', 'blue', 'red') + Split::Experiment.find_or_create("link_color", "blue", "red") } + let(:experiment_with_goals) { + Split::Experiment.find_or_create({"link_color" => ["goal_1", "goal_2"]}, "blue", "red") + } + let(:red_link) { link("red") } let(:blue_link) { link("blue") } it "should respond to /" do get '/' last_response.should be_ok end - it "should start experiment" do - Split.configuration.start_manually = true - experiment - get '/' - last_response.body.should include('Start') + context "start experiment manually" do + before do + Split.configuration.start_manually = true + end - post "/start/#{experiment.name}" - get '/' - last_response.body.should include('Reset Data') + context "experiment without goals" do + it "should display a Start button" do + experiment + get '/' + last_response.body.should include('Start') + + post "/start/#{experiment.name}" + get '/' + last_response.body.should include('Reset Data') + end + end + + context "with goals" do + it "should display a Start button" do + experiment_with_goals + get '/' + last_response.body.should include('Start') + + post "/start/#{experiment.name}" + get '/' + last_response.body.should include('Reset Data') + end + end end it "should reset an experiment" do red_link.participant_count = 5 blue_link.participant_count = 7